Permalink
Browse files

slight tweak to URLState

  • Loading branch information...
1 parent 32bd9bf commit b586658d61af7736d546c9817caef00a65aadc30 @itod committed Apr 15, 2010
Showing with 16 additions and 1 deletion.
  1. +1 −1 src/PKURLState.m
  2. +15 −0 test/TDURLStateTest.m
View
@@ -88,7 +88,7 @@ - (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin token
}
if (matched) {
- if ('.' == lastChar || ',' == lastChar) {
+ if ('.' == lastChar || ',' == lastChar || '-' == lastChar) {
s = [s substringToIndex:[s length] - 1];
[r unread];
}
View
@@ -36,6 +36,21 @@ - (void)testFooComBlahBlah {
}
+- (void)testDunningDashKruger {
+ s = @"http://en.wikipedia.org/wiki/Dunning–Kruger_effect";
+ t.string = s;
+
+ tok = [t nextToken];
+
+ TDTrue(tok.isURL);
+ TDEqualObjects(tok.stringValue, s);
+ TDEquals(tok.floatValue, (CGFloat)0.0);
+
+ tok = [t nextToken];
+ TDEqualObjects(tok, [PKToken EOFToken]);
+}
+
+
- (void)testFooComBlahBlahSlash {
s = @"http://foo.com/blah_blah/";
t.string = s;

0 comments on commit b586658

Please sign in to comment.