Should unit testing functions for Objective-C
Objective-C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Should-C.xcodeproj
Should-C
Should-CTests
.gitignore
README

README

For now I am just playing around with some ideas for improving the Objective-C unit testing experience.

I do like the Shouldly framework for .NET, so I used those symantics as a starting point.

I'm not in love with any of this API yet, I just want to start playing around and hope I come up with something that works.

A basic test looks like this:

	- (void) test_objectShouldEqual_twoIdenticalStrings_shouldNotFail
	{
	    NSString *left = @"i am string;
	    NSString *right = @"i am string";
	    
	    [Test object:left shouldEqual:right];
	}

	- (void) test_objectShouldEqual_objectIsNilOtherIsNot_shouldFail
	{
	    NSString *left = nil;
	    NSString *right = @"i am string";
	    
	    [Test shouldFail:^{
	        [Test object:left shouldEqual:right];
	    }];
	}

	- (void) test_somethingThatReturnsAnInt_shouldFail
	{
	    int i = [<something that returns an int>];
	    int expected = 55;
	    
	    [Test shouldFail:^{
	        [Test int:i shouldEqual:expected];
	    }];
	}