產品構建成功,但測試失敗。我如何通過下面的STAssertEquals
報告的類型不匹配失敗?Xcode:Objective-C:類型不匹配
// 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