0
我試圖獲得OSX簡單OCMock測試和運行,但似乎無法得到正確的安裝。我相信我遵循了這些說明,但測試版本在鏈接步驟失敗。OCMock鏈接錯誤
在fooTests.m:
#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()(即我沒有包含某些東西),因此它不知道該鏈接什麼,因此其他兩個錯誤。我只是不知道我還需要包括什麼。
很好,謝謝,我知道我是在深夜做一些愚蠢的事! – John