aboutsummaryrefslogtreecommitdiffstats
path: root/UnitTests/SPDataAdditionsTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'UnitTests/SPDataAdditionsTests.m')
-rw-r--r--UnitTests/SPDataAdditionsTests.m11
1 files changed, 11 insertions, 0 deletions
diff --git a/UnitTests/SPDataAdditionsTests.m b/UnitTests/SPDataAdditionsTests.m
index c7a03f7f..988267d2 100644
--- a/UnitTests/SPDataAdditionsTests.m
+++ b/UnitTests/SPDataAdditionsTests.m
@@ -371,6 +371,17 @@
}];
STAssertTrue(invocations==2, @"other line breaks when only CRLF is expected");
}
+ //stopping early
+ {
+ const char inp[] = "Two\nLines\n";
+ __block NSUInteger invocations = 0;
+ NSData *data = [NSData dataWithBytes:inp length:strlen(inp)];
+ [data enumerateLinesBreakingAt:SPLineTerminatorAny withBlock:^(NSRange line, BOOL *stop) {
+ invocations++;
+ *stop = YES;
+ }];
+ STAssertTrue(invocations==1, @"File with two lines, stopped after first");
+ }
}
@end