OSX에 대한 간단한 OCMock 테스트를 실행하려고하지만 설치를 제대로 수행 할 수 없습니다. 나는 지침을 따른 것으로 믿지만 테스트 단계는 링크 단계에서 실패하고 있습니다. fooTests.m 내OCMock 링크 오류
:
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
@interface fooTests : XCTestCase
@end
@implementation fooTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testOCMockPass {
id mock = [OCMockObject mockForClass:NSString.class];
[[[mock stub] andReturn:@"mocktest"] lowercaseString];
NSString *returnValue = [mock lowercaseString];
STAssertEqualObjects(@"mocktest", returnValue, @"Should have returned the expected string.");
}
@end
그러나 빌드, 나는 다음과 같은 경고/오류를 얻을 :
fooTests.m:56:5: Implicit declaration of function 'STAssertEqualObjects' is invalid in C99
Undefined symbols for architecture x86_64:
"_STAssertEqualObjects", referenced from:
-[fooTests testOCMockPass] in fooTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
나는 "라이브러리와 링크 바이너리는"XCTest & OCMock와 연결있어 테스트 빌드 단계에서. OCMock.framework는 기본 디렉터리에 있으며 프레임 워크와 헤더의 검색 경로에도 있습니다. 누구든지 내가 뭘 잘못하고 있는지 말해 주겠니?
컴파일러는 STAssertEqualObjects()가 무엇인지 (예 : 내가 포함되지 않았 음) 알지 못해서 무엇을 연결할 지 알지 못하므로 다른 2 가지 오류가있는 것처럼 보입니다. 나는 내가 무엇을 포함시켜야하는지 알지 못한다.
대단히 감사합니다. 나는 밤늦게 바보 같은 짓을하고 있다는 것을 알았습니다! – John