Permalink
Browse files

Add iOS test and compile without warnings using `-Weverything`

  • Loading branch information...
1 parent b19950e commit 801dd820f24f2ca51df13e6ae20cb203ec6fa17e @soffes committed Mar 21, 2013
View
@@ -1,16 +1,7 @@
desc 'Run the tests'
task :test do
- command = 'xcodebuild -project Tests/SSKeychain.xcodeproj -scheme SSKeychainTests TEST_AFTER_BUILD=YES 2>&1'
- IO.popen(command) do |io|
- while line = io.gets do
- puts line
- if line == "** BUILD SUCCEEDED **\n"
- exit 0
- elsif line == "** BUILD FAILED **\n"
- exit 1
- end
- end
- end
+ test_scheme 'SSKeychainTests-Mac'
+ test_scheme 'SSKeychainTests-iOS'
end
task :default => :test
@@ -52,3 +43,17 @@ namespace :docs do
`appledoc #{appledoc_options.join(' ')} #{extra_options.join(' ')} #{header_path}`
end
end
+
+def test_scheme(scheme)
+ command = "xcodebuild -project Tests/SSKeychain.xcodeproj -scheme #{scheme} TEST_AFTER_BUILD=YES 2>&1"
+ IO.popen(command) do |io|
+ while line = io.gets do
+ puts line
+ if line == "** BUILD SUCCEEDED **\n"
+ return 0
+ elsif line == "** BUILD FAILED **\n"
+ return 1
+ end
+ end
+ end
+end
@@ -22,8 +22,10 @@
/** kSecAttrLabel */
@property (nonatomic, copy) NSString *label;
+#if __IPHONE_3_0 && TARGET_OS_IPHONE
/** kSecAttrAccessGroup (only used on iOS) */
@property (nonatomic, copy) NSString *accessGroup;
+#endif
/**
You do not need to set both of these.
@@ -13,9 +13,19 @@
@implementation SSKeychainQuery
+@synthesize account = _account;
+@synthesize service = _service;
+@synthesize label = _label;
+@synthesize passwordData = _passwordData;
+
+#if __IPHONE_3_0 && TARGET_OS_IPHONE
+@synthesize accessGroup = _accessGroup;
+#endif
+
+
#pragma mark - Public
-- (BOOL)save:(NSError **)error {
+- (BOOL)save:(NSError *__autoreleasing *)error {
OSStatus status = SSKeychainErrorBadArguments;
if (!self.service || !self.account || !self.passwordData) {
if (error) {
@@ -47,7 +57,7 @@ - (BOOL)save:(NSError **)error {
}
-- (BOOL)delete:(NSError **)error {
+- (BOOL)delete:(NSError *__autoreleasing *)error {
OSStatus status = SSKeychainErrorBadArguments;
if (!self.service || !self.account) {
if (error) {
@@ -77,7 +87,7 @@ - (BOOL)delete:(NSError **)error {
}
-- (NSArray *)fetchAll:(NSError **)error {
+- (NSArray *)fetchAll:(NSError *__autoreleasing *)error {
OSStatus status = SSKeychainErrorBadArguments;
NSMutableDictionary *query = [self query];
[query setObject:@YES forKey:(__bridge id)kSecReturnAttributes];
@@ -94,7 +104,7 @@ - (NSArray *)fetchAll:(NSError **)error {
}
-- (BOOL)fetch:(NSError **)error {
+- (BOOL)fetch:(NSError *__autoreleasing *)error {
OSStatus status = SSKeychainErrorBadArguments;
if (!self.service || !self.account) {
if (error) {
@@ -127,8 +137,8 @@ - (void)setPassword:(NSString *)password {
- (NSString *)password {
- if (_passwordData) {
- return [[NSString alloc] initWithData:_passwordData encoding:NSUTF8StringEncoding];
+ if (self.passwordData) {
+ return [[NSString alloc] initWithData:self.passwordData encoding:NSUTF8StringEncoding];
}
return nil;
}
Oops, something went wrong.

0 comments on commit 801dd82

Please sign in to comment.