From 79b5c2a55cb35167e44616cc9a67afa08014f7cb Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Tue, 20 Oct 2015 12:57:17 -0400 Subject: Minor fixes - Support for GCC_WARN_STRICT_SELECTOR_MATCH - Fix long busted XTCAssertEqualCStrings --- UnitTesting/GTMSenTestCase.h | 18 ++++++++++-------- .../English.lproj/Localizable.strings | Bin 685 -> 1372 bytes 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'UnitTesting') diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h index 4c372c7..3ed752a 100644 --- a/UnitTesting/GTMSenTestCase.h +++ b/UnitTesting/GTMSenTestCase.h @@ -316,8 +316,8 @@ ({ \ NSString *_failure = nil; \ @try { \ - id _a1value = (a1); \ - id _a2value = (a2); \ + NSString *_a1value = (a1); \ + NSString *_a2value = (a2); \ NSComparisonResult _result; \ if (![_a1value isKindOfClass:[NSString class]]) { \ _failure = [NSString stringWithFormat:@"(%@) is not an NSString* (%@)", @#a1, [_a1value class]]; \ @@ -356,8 +356,8 @@ ({ \ NSString *_failure = nil; \ @try { \ - id _a1value = (a1); \ - id _a2value = (a2); \ + NSString *_a1value = (a1); \ + NSString *_a2value = (a2); \ NSComparisonResult _result; \ if (![_a1value isKindOfClass:[NSString class]]) { \ _failure = [NSString stringWithFormat:@"(%@) is not an NSString* (%@)", @#a1, [_a1value class]]; \ @@ -394,18 +394,20 @@ @try { \ const char* _a1value = (a1); \ const char* _a2value = (a2); \ - if (_a1value != _a2value && strcmp(_a1value, _a2value) != 0) { \ - _failure = @""; \ + if (_a1value != _a2value && \ + (_a1value == NULL || _a2value == NULL || strcmp(_a1value, _a2value) != 0)) { \ + _failure = [NSString stringWithFormat:@"strcmp(\"%s\", \"%s\") != 0", _a1value, _a2value]; \ }\ } \ @catch (NSException *_exception) { \ _failure = [NSString stringWithFormat:@": " _XCExceptionFormatString, [_exception reason]]; \ } \ @catch (...) { \ - _failure = @": "_XCUnknownExceptionString; \ + _failure = @": " _XCUnknownExceptionString; \ } \ if (_failure) { \ - NSString *_expression = [NSString stringWithFormat:@"((%s) == (%s) failed%@", @#a1, @#a2, _failure]; \ + NSString *_expression = [NSString stringWithFormat:@"((%@) vs. (%@) failed: %@", \ + GTM_NSSTRINGIFY(a1), GTM_NSSTRINGIFY(a2), _failure]; \ _GTMXCRegisterFailure(_expression, format); \ } \ }) diff --git a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/Localizable.strings b/UnitTesting/GTMUIUnitTestingHarness/English.lproj/Localizable.strings index 567e3f7..6eb49a5 100644 Binary files a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/Localizable.strings and b/UnitTesting/GTMUIUnitTestingHarness/English.lproj/Localizable.strings differ -- cgit v1.2.3