Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmill committed May 7, 2024
1 parent 469bf38 commit b1464d1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/lean/run/crlfToLf.lean
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"

0 comments on commit b1464d1

Please sign in to comment.