Skip to content

Commit

Permalink
Added Macintosh line break. Closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne4istb committed Jan 28, 2016
1 parent cd94f8b commit 68782c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/src/verbal_expression.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ class VerbalExpression {
add('([^${sanitize(value)}]+)');
}

/// Adds universal (Unix + Windows CRLF) line break expression
/// Adds universal (Unix + Windows CRLF + Macintosh) line break expression
void lineBreak() {
add('(\\r\\n|\\r|\\n)');
add('(\\r\\n|\\r|\\n|\\r\\r)');
}

/// Shortcut for [this.lineBreak()]
Expand Down
6 changes: 4 additions & 2 deletions test/line_break_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class LineBreakTests {
..lineBreak()
..endOfLine();

expect(verbalExpression.toString(), '^(\\r\\n|\\r|\\n)\$',
reason: 'Regex should be "^(\\r\\n|\\r|\\n)\$"');
expect(verbalExpression.toString(), '^(\\r\\n|\\r|\\n|\\r\\r)\$',
reason: 'Regex should be "^(\\r\\n|\\r|\\n|\\r\\r)\$"');
});

test('Should match', () {
Expand All @@ -35,6 +35,8 @@ class LineBreakTests {
reason: 'abc then line break then def');
expect(matcher.hasMatch('abc\ndef'), isTrue,
reason: 'abc then line break then def');
expect(matcher.hasMatch('abc\r\rdef'), isTrue,
reason: 'abc then line break then def');
expect(matcher.hasMatch('abc\r\n def'), isFalse,
reason: 'abc then line break then space then def');
});
Expand Down

0 comments on commit 68782c2

Please sign in to comment.