diff options
author | EuAndreh <eu@euandre.org> | 2025-05-13 07:20:48 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-05-13 15:13:17 -0300 |
commit | 8f4541232bbe127dd90d0fb9a3278e0636b8cba7 (patch) | |
tree | 5c90673d7f7262533044093b4d40bde07982b725 /tests/gobang.go | |
parent | src/gobang.go: Add Heredoc() (diff) | |
download | gobang-8f4541232bbe127dd90d0fb9a3278e0636b8cba7.tar.gz gobang-8f4541232bbe127dd90d0fb9a3278e0636b8cba7.tar.xz |
Revamp Heredoc(), add fuzz to prevent panics
Diffstat (limited to 'tests/gobang.go')
-rw-r--r-- | tests/gobang.go | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/tests/gobang.go b/tests/gobang.go index 7391475..e0fde2f 100644 --- a/tests/gobang.go +++ b/tests/gobang.go @@ -28,20 +28,43 @@ func test_Heredoc() { and end `) - expected := ` Start - and - end -` + expected := " Start\n and\n end\n" TAssertEqual(given, expected) }) - Testing("removes ALL tabs", func() { - given := Heredoc(` + Testing("removes only indenting tabs", func() { + given1 := Heredoc(` Tab here> <within the line `) + const expected1 = "Tab here> <within the line\n" + + given2 := Heredoc(` + some + uneven + indentation + `) + const expected2 = "some\n\tuneven\n\t\tindentation\n" + + given3 := Heredoc(` + some + mixed + indentation + `) + const expected3 = "\tsome\n mixed\n\t\tindentation\n" + + TAssertEqual(given1, expected1) + TAssertEqual(given2, expected2) + TAssertEqual(given3, expected3) + }) - expected := "Tab here><within the line\n" + Testing("empty lines are removed", func() { + given := Heredoc(` + line 1 + + line 2 + `) + const expected = "line 1\n\nline 2\n" TAssertEqual(given, expected) }) |