aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSObject+KeyValueObservingTest.m
diff options
context:
space:
mode:
authorGravatar dmaclach <dmaclach@google.com>2016-10-07 12:10:23 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-10-07 12:21:06 -0400
commit42124b3691197c3c4f52f069775fa0390a8ff942 (patch)
treeebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /Foundation/GTMNSObject+KeyValueObservingTest.m
parent57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff)
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying to update it it. Some would be hard to update, some actually has system provided replacements; others are patterns that just don't seem as common now. Prune out the code related to macOS <= 10.5, start pruning some of the really old iOS support also. Get the projects mostly limping again with modern Xcodes so tests can be run. If someone ends up on this commit via history for something they still find as useful, feel free to do a pull request to bring the snippet of code back to life and update it for current SDKs.
Diffstat (limited to 'Foundation/GTMNSObject+KeyValueObservingTest.m')
-rw-r--r--Foundation/GTMNSObject+KeyValueObservingTest.m26
1 files changed, 10 insertions, 16 deletions
diff --git a/Foundation/GTMNSObject+KeyValueObservingTest.m b/Foundation/GTMNSObject+KeyValueObservingTest.m
index 43a1bba..66ae799 100644
--- a/Foundation/GTMNSObject+KeyValueObservingTest.m
+++ b/Foundation/GTMNSObject+KeyValueObservingTest.m
@@ -29,7 +29,6 @@
#import "GTMSenTestCase.h"
#import "GTMNSObject+KeyValueObserving.h"
#import "GTMDefines.h"
-#import "GTMUnitTestDevLog.h"
@interface GTMNSObject_KeyValueObservingTest : GTMTestCase {
int32_t count_;
@@ -61,12 +60,12 @@
options:NSKeyValueObservingOptionNew];
expectedValue_ = @"bar";
[dict_ setObject:expectedValue_ forKey:@"key"];
- STAssertEquals(count_, (int32_t)1, nil);
+ XCTAssertEqual(count_, (int32_t)1);
[dict_ gtm_removeObserver:self
forKeyPath:@"key"
selector:@selector(observeValueChange:)];
[dict_ setObject:@"foo" forKey:@"key"];
- STAssertEquals(count_, (int32_t)1, nil);
+ XCTAssertEqual(count_, (int32_t)1);
}
- (void)testStopObservingAllKeyPaths {
@@ -78,17 +77,14 @@
options:NSKeyValueObservingOptionNew];
expectedValue_ = @"bar";
[dict_ setObject:expectedValue_ forKey:@"key"];
- STAssertEquals(count_, (int32_t)1, nil);
+ XCTAssertEqual(count_, (int32_t)1);
[self gtm_stopObservingAllKeyPaths];
[dict_ setObject:@"foo" forKey:@"key"];
- STAssertEquals(count_, (int32_t)1, nil);
+ XCTAssertEqual(count_, (int32_t)1);
}
- (void)testRemoving {
- [GTMUnitTestDevLogDebug expectPattern:@"-\\[GTMNSObject_KeyValueObservingTest"
- @" testRemoving\\] was not observing.*"];
-
[dict_ gtm_removeObserver:self
forKeyPath:@"key"
selector:@selector(observeValueChange:)];
@@ -100,8 +96,6 @@
selector:@selector(observeValueChange:)
userInfo:@"userInfo"
options:NSKeyValueObservingOptionNew];
- [GTMUnitTestDevLog expectPattern:@"-\\[GTMNSObject_KeyValueObservingTest"
- @" testAdding\\] already observing.*"];
[dict_ gtm_addObserver:self
forKeyPath:@"key"
selector:@selector(observeValueChange:)
@@ -113,17 +107,17 @@
}
- (void)observeValueChange:(GTMKeyValueChangeNotification *)notification {
- STAssertEqualObjects([notification userInfo], @"userInfo", nil);
- STAssertEqualObjects([notification keyPath], @"key", nil);
- STAssertEqualObjects([notification object], dict_, nil);
+ XCTAssertEqualObjects([notification userInfo], @"userInfo");
+ XCTAssertEqualObjects([notification keyPath], @"key");
+ XCTAssertEqualObjects([notification object], dict_);
NSDictionary *change = [notification change];
NSString *value = [change objectForKey:NSKeyValueChangeNewKey];
- STAssertEqualObjects(value, expectedValue_, nil);
+ XCTAssertEqualObjects(value, expectedValue_);
++count_;
GTMKeyValueChangeNotification *copy = [[notification copy] autorelease];
- STAssertEqualObjects(notification, copy, nil);
- STAssertEquals([notification hash], [copy hash], nil);
+ XCTAssertEqualObjects(notification, copy);
+ XCTAssertEqual([notification hash], [copy hash]);
}
@end