Skip to content

Instantly share code, notes, and snippets.

View jonreid's full-sized avatar

Jon Reid jonreid

View GitHub Profile
View TestingAppDelegate.swift
import UIKit
@objc(TestingAppDelegate)
class TestingAppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
View main.swift
import UIKit
let appDelegateClass: AnyClass = NSClassFromString("TestingAppDelegate") ?? AppDelegate.self
UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(appDelegateClass))
@jonreid
jonreid / gist:1283431
Created October 13, 2011 05:01
Test using OCHamcrest 1.6 hasProperty matcher
View gist:1283431
- (void)testArrayFromURLStringArray
{
// given
NSArray *URLStrings = [NSArray arrayWithObjects:@"one", @"two", nil];
// when
NSMutableArray *downloads = [MyDownloader arrayFromURLStringArray:URLStrings];
// then
assertThat(downloads, contains(hasProperty(@"URLString", @"one"),
@jonreid
jonreid / gist:1283418
Created October 13, 2011 04:52
Test before OCHamcrest 1.6
View gist:1283418
- (void)testArrayFromURLStringArray
{
// given
NSArray *URLStrings = [NSArray arrayWithObjects:@"one", @"two", nil];
// when
NSMutableArray *downloads = [MyDownloader arrayFromURLStringArray:URLStrings];
// then
assertThat(downloads, hasCountOf(2));
@jonreid
jonreid / gist:1258076
Last active November 26, 2020 11:09
Terminal command to help you find preprocessor code smells in Objective-C code
View gist:1258076
find . \( \( -name "*.[chm]" -o -name "*.mm" \) -o -name "*.cpp" \) -print0 | xargs -0 egrep -n '^\w*\#' | egrep -v '(import|pragma|else|endif|HC_SHORTHAND|MOCKITO_SHORTHAND)'