Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from meiwin/sanitized-description

sanitize description on exception.
  • Loading branch information...
commit 8d6b6419bd161aaf3d69d53cd14217287476dd92 2 parents 23bd3cc + c6a67b6
@petejkim petejkim authored
Showing with 3 additions and 2 deletions.
  1. +2 −1  src/SPTSenTestCase.m
  2. +1 −1  test/UnexpectedExceptionTest.m
View
3  src/SPTSenTestCase.m
@@ -112,8 +112,9 @@ - (void)logException:(NSException *)exception {
description = [NSString stringWithFormat:@"%@\n Call Stack:\n %@", description, [callStack componentsJoinedByString:@"\n "]];
}
}
+ NSString * sanitizedDescription = [description stringByReplacingOccurrencesOfString:@"%@" withString:@"?"];
exception = [NSException exceptionWithName:name reason:description
- userInfo:[[NSException failureInFile:file atLine:0 withDescription:description] userInfo]];
+ userInfo:[[NSException failureInFile:file atLine:0 withDescription:sanitizedDescription] userInfo]];
}
SPTSenTestCase *currentTestCase = [[[NSThread currentThread] threadDictionary] objectForKey:@"SPT_currentTestCase"];
[currentTestCase.SPT_run addException:exception];
View
2  test/UnexpectedExceptionTest.m
@@ -5,7 +5,7 @@
static BOOL shouldRaiseException = NO;
static void raiseException() {
- [[NSException exceptionWithName:@"MyException" reason:@"Oh Noes!" userInfo:nil] raise];
+ [[NSException exceptionWithName:@"MyException" reason:@"Oh Noes! %@" userInfo:nil] raise];
}
SpecBegin(_UnexpectedExceptionTest)
Please sign in to comment.
Something went wrong with that request. Please try again.