Sha256: 8f80c9672161d2bfba4a988d2c003f5782935da4af8ed99df370f474e36ecf48

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

#import "EXPMatchers+raise.h"
#import "EXPDefines.h"

EXPMatcherImplementationBegin(raise, (NSString *expectedExceptionName)) {
  __block NSException *exceptionCaught = nil;

  match(^BOOL{
    BOOL expectedExceptionCaught = NO;
    @try {
      ((EXPBasicBlock)actual)();
    } @catch(NSException *e) {
      exceptionCaught = e;
      expectedExceptionCaught = (expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName];
    }
    return expectedExceptionCaught;
  });

  failureMessageForTo(^NSString *{
    return [NSString stringWithFormat:@"expected: %@, got: %@",
            expectedExceptionName ? expectedExceptionName : @"any exception",
            exceptionCaught ? [exceptionCaught name] : @"no exception"];
  });

  failureMessageForNotTo(^NSString *{
    return [NSString stringWithFormat:@"expected: %@, got: %@",
            expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception",
            exceptionCaught ? [exceptionCaught name] : @"no exception"];
  });
}
EXPMatcherImplementationEnd

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
second_curtain-0.6.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m
second_curtain-0.5.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m
second_curtain-0.4.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m
second_curtain-0.3.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m
cocoapods-deintegrate-0.2.1 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/matchers/EXPMatchers+raise.m
cocoapods-deintegrate-0.2.0 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/matchers/EXPMatchers+raise.m
second_curtain-0.2.4 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m
second_curtain-0.2.3 Demo/Pods/Expecta/src/matchers/EXPMatchers+raise.m