Browse files

Fix a bug that when multibyte characters or '(', ')' are contained in…

… description, Test Runner doesn't show errors even if the example failed
  • Loading branch information...
1 parent 1da49a1 commit 97f4cbd50b201fa753a360f782422a4ff7e92b34 @ikesyo ikesyo committed Apr 20, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 Kiwi/KWSpec.m
View
7 Kiwi/KWSpec.m
@@ -64,10 +64,9 @@ - (NSString *)description
name = [name stringByReplacingOccurrencesOfString:@"," withString:@"_"];
// Strip out characters not legal in function names
- NSMutableCharacterSet *illegalCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
- [illegalCharacters addCharactersInString:@"_()"];
- [illegalCharacters invert];
- name = [[name componentsSeparatedByCharactersInSet:illegalCharacters] componentsJoinedByString:@""];
+ NSError *error = nil;
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^a-zA-Z0-9_]*" options:0 error:&error];
+ name = [regex stringByReplacingMatchesInString:name options:0 range:NSMakeRange(0, name.length) withTemplate:@""];
return [NSString stringWithFormat:@"-[%@ %@]", NSStringFromClass([self class]), name];
}

0 comments on commit 97f4cbd

Please sign in to comment.