From 42124b3691197c3c4f52f069775fa0390a8ff942 Mon Sep 17 00:00:00 2001 From: dmaclach Date: Fri, 7 Oct 2016 12:10:23 -0400 Subject: 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. --- Foundation/GTMSignalHandlerTest.m | 43 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'Foundation/GTMSignalHandlerTest.m') diff --git a/Foundation/GTMSignalHandlerTest.m b/Foundation/GTMSignalHandlerTest.m index 5cddcb5..bd70ecf 100644 --- a/Foundation/GTMSignalHandlerTest.m +++ b/Foundation/GTMSignalHandlerTest.m @@ -18,7 +18,6 @@ #import "GTMSenTestCase.h" #import "GTMSignalHandler.h" -#import "GTMUnitTestDevLog.h" #import "GTMFoundationUnitTestingUtilities.h" @interface GTMSignalHandlerTest : GTMTestCase @@ -66,56 +65,54 @@ @implementation GTMSignalHandlerTest - (void)nomnomnom:(int)blah { - STFail(@"Should never be called!"); + XCTFail(@"Should never be called!"); } - (void)testNillage { GTMSignalHandler *handler; // Just an init should return nil. - [GTMUnitTestDevLog expectString:@"Don't call init, use " - @"initWithSignal:target:action:"]; handler = [[[GTMSignalHandler alloc] init] autorelease]; - STAssertNil(handler, nil); + XCTAssertNil(handler); // Zero signal should return nil as well. handler = [[[GTMSignalHandler alloc] initWithSignal:0 target:self action:@selector(nomnomnom:)] autorelease]; - STAssertNil(handler, nil); + XCTAssertNil(handler); } - (void)testSingleHandler { SignalCounter *counter = [SignalCounter signalCounter]; - STAssertNotNil(counter, nil); + XCTAssertNotNil(counter); GTMSignalHandler *handler = [[[GTMSignalHandler alloc] initWithSignal:SIGWINCH target:counter action:@selector(countSignal:)] autorelease]; - STAssertNotNil(handler, nil); + XCTAssertNotNil(handler); raise(SIGWINCH); NSRunLoop *rl = [NSRunLoop currentRunLoop]; [rl gtm_runUpToSixtySecondsWithContext:counter]; - STAssertEquals([counter count], 1, nil); - STAssertEquals([counter lastSeen], SIGWINCH, nil); + XCTAssertEqual([counter count], 1); + XCTAssertEqual([counter lastSeen], SIGWINCH); [counter resetShouldStop]; raise(SIGWINCH); [rl gtm_runUpToSixtySecondsWithContext:counter]; - STAssertEquals([counter count], 2, nil); - STAssertEquals([counter lastSeen], SIGWINCH, nil); + XCTAssertEqual([counter count], 2); + XCTAssertEqual([counter lastSeen], SIGWINCH); [counter resetShouldStop]; // create a second one to make sure we're seding data where we want SignalCounter *counter2 = [SignalCounter signalCounter]; - STAssertNotNil(counter2, nil); + XCTAssertNotNil(counter2); [[[GTMSignalHandler alloc] initWithSignal:SIGUSR1 target:counter2 action:@selector(countSignal:)] autorelease]; @@ -123,10 +120,10 @@ raise(SIGUSR1); [rl gtm_runUpToSixtySecondsWithContext:counter2]; - STAssertEquals([counter count], 2, nil); - STAssertEquals([counter lastSeen], SIGWINCH, nil); - STAssertEquals([counter2 count], 1, nil); - STAssertEquals([counter2 lastSeen], SIGUSR1, nil); + XCTAssertEqual([counter count], 2); + XCTAssertEqual([counter lastSeen], SIGWINCH); + XCTAssertEqual([counter2 count], 1); + XCTAssertEqual([counter2 lastSeen], SIGUSR1); [handler invalidate]; @@ -135,16 +132,16 @@ raise(SIGWINCH); [rl runUntilDate:[NSDate dateWithTimeIntervalSinceNow:.2]]; - STAssertEquals([counter count], 2, nil); - STAssertEquals([counter lastSeen], SIGWINCH, nil); - STAssertEquals([counter2 count], 1, nil); - STAssertEquals([counter2 lastSeen], SIGUSR1, nil); + XCTAssertEqual([counter count], 2); + XCTAssertEqual([counter lastSeen], SIGWINCH); + XCTAssertEqual([counter2 count], 1); + XCTAssertEqual([counter2 lastSeen], SIGUSR1); } - (void)testIgnore { SignalCounter *counter = [SignalCounter signalCounter]; - STAssertNotNil(counter, nil); + XCTAssertNotNil(counter); [[[GTMSignalHandler alloc] initWithSignal:SIGUSR1 target:counter @@ -153,7 +150,7 @@ raise(SIGUSR1); NSRunLoop *rl = [NSRunLoop currentRunLoop]; [rl runUntilDate:[NSDate dateWithTimeIntervalSinceNow:.2]]; - STAssertEquals([counter count], 0, nil); + XCTAssertEqual([counter count], 0); } -- cgit v1.2.3