Skip to content

Instantly share code, notes, and snippets.

@robb
Created February 3, 2014 01:26
Show Gist options
  • Save robb/8777652 to your computer and use it in GitHub Desktop.
Save robb/8777652 to your computer and use it in GitHub Desktop.
boolean operators for matchers
@interface FooTests : XCTestCase
@end
@implementation FooTests
- (void)testAnd {
expect(@"foo")
.to.beKindOfClass(NSString.class)
.and.equal(@"foo");
}
- (void)testOr {
expect(@"foo")
.to.equal(@"bar")
.or.equal(@"foo");
expect(@"foo")
.to.equal(@"foo")
.or.equal(@"bar");
expect(@"foo")
.to.equal(@"bar")
.or.equal(@"foo")
.or.equal(@"bar");
}
- (void)testOrAndAnd {
expect(@"foo")
.to
.beKindOfClass(NSString.class)
.and.equal(@"foo")
.or
.beKindOfClass(NSNumber.class)
.and.equal(@2)
.or
.beKindOfClass(NSNull.class)
.and.equal(NSNull.null);
expect(@2)
.to
.beKindOfClass(NSString.class)
.and.equal(@"foo")
.or
.beKindOfClass(NSNumber.class)
.and.equal(@2)
.or
.beKindOfClass(NSNull.class)
.and.equal(NSNull.null);
expect(NSNull.null)
.to
.beKindOfClass(NSString.class)
.and.equal(@"foo")
.or
.beKindOfClass(NSNumber.class)
.and.equal(@2)
.or
.beKindOfClass(NSNull.class)
.and.equal(NSNull.null);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment