제품 빌드가 성공했지만 테스트가 실패합니다. 아래에 STAssertEquals
행에보고 된 유형 불일치 오류를 어떻게 전달합니까?Xcode : Objective-C : 형식이 일치하지 않습니다.
STAssertEquals((TransactionType)transaction.type, TransactionTypePay, @"type property works");
하지만, 왜 내가해야 :
// TransactionSpec.m
#import "Transaction.h"
@interface TransactionSpec : SenTestCase
@end
@implementation TransactionSpec
#pragma mark Properties
- (void)testProperties {
Transaction *transaction = [[Transaction alloc] init];
transaction.type = TransactionTypePay;
STAssertNotNil(transaction, @"transaction exists");
STAssertEquals(transaction.type, TransactionTypePay, @"type property works"); // Type mismatch
}
@end
// Transaction.h
typedef enum {
TransactionTypePay,
TransactionTypeCharge
} TransactionType;
@interface Transaction : NSObject
@property (nonatomic) TransactionType *type;
@end
// Transaction.m
#import "Transaction.h"
@implementation Transaction
@synthesize type;
@end
어떻게 선언해야합니까? 난 그냥 [''] (https://github.com/enormego/UIKit/blob/af0df999735b29259b2a64342d616bc04bce54de/UITableView.h#L15-18). –
ma11hew28
오! 알았다! 감사! – ma11hew28