-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/-! | ||
# Test `String.crlfToLf` | ||
-/ | ||
|
||
/-! | ||
Leaves single `\n`'s alone. | ||
-/ | ||
/-- info: "hello\nworld" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\nworld" | ||
|
||
/-! | ||
Turns `\r\n` into `\n`. | ||
-/ | ||
/-- info: "hello\nworld" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\r\nworld" | ||
|
||
/-! | ||
In a string of `\r...\r\n`, only normalizes the last `\r\n`. | ||
-/ | ||
/-- info: "hello\x0d\nworld" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\r\r\nworld" | ||
|
||
/-! | ||
Two in a row. | ||
-/ | ||
/-- info: "hello\n\nworld" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\r\n\r\nworld" | ||
|
||
/-! | ||
Normalizes at the end. | ||
-/ | ||
/-- info: "hello\nworld\n" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\r\nworld\r\n" | ||
|
||
/-! | ||
Can handle a loose `\r` as the last character. | ||
-/ | ||
/-- info: "hello\nworld\x0d" -/ | ||
#guard_msgs in #eval String.crlfToLf "hello\r\nworld\r" |