diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/heredoc/gobang.go | 4 | ||||
l--------- | tests/benchmarks/heredoc/main.go | 1 | ||||
-rw-r--r-- | tests/functional/metrics/gobang.go | 4 | ||||
l--------- | tests/functional/metrics/main.go | 1 | ||||
-rw-r--r-- | tests/fuzz/count-leading-chars/gobang.go | 30 | ||||
l--------- | tests/fuzz/count-leading-chars/main.go | 1 | ||||
-rw-r--r-- | tests/fuzz/heredoc/gobang.go | 30 | ||||
l--------- | tests/fuzz/heredoc/main.go | 1 | ||||
-rw-r--r-- | tests/gobang.go | 37 |
9 files changed, 102 insertions, 7 deletions
diff --git a/tests/benchmarks/heredoc/gobang.go b/tests/benchmarks/heredoc/gobang.go new file mode 100644 index 0000000..7a4743a --- /dev/null +++ b/tests/benchmarks/heredoc/gobang.go @@ -0,0 +1,4 @@ +package gobang + +func MainTest() { +} diff --git a/tests/benchmarks/heredoc/main.go b/tests/benchmarks/heredoc/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/benchmarks/heredoc/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/functional/metrics/gobang.go b/tests/functional/metrics/gobang.go new file mode 100644 index 0000000..7a4743a --- /dev/null +++ b/tests/functional/metrics/gobang.go @@ -0,0 +1,4 @@ +package gobang + +func MainTest() { +} diff --git a/tests/functional/metrics/main.go b/tests/functional/metrics/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/metrics/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/fuzz/count-leading-chars/gobang.go b/tests/fuzz/count-leading-chars/gobang.go new file mode 100644 index 0000000..5b9736d --- /dev/null +++ b/tests/fuzz/count-leading-chars/gobang.go @@ -0,0 +1,30 @@ +package gobang + +import ( + "os" + "testing" + "testing/internal/testdeps" +) + + + +func fn(f *testing.F) { + f.Fuzz(func(t *testing.T, s string, c byte) { + countLeadingChar(s, c) + }) +} + + + +func MainTest() { + fuzzTargets := []testing.InternalFuzzTarget{ + { "count-leading-char", fn }, + } + + deps := testdeps.TestDeps{} + tests := []testing.InternalTest {} + benchmarks := []testing.InternalBenchmark{} + examples := []testing.InternalExample {} + m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples) + os.Exit(m.Run()) +} diff --git a/tests/fuzz/count-leading-chars/main.go b/tests/fuzz/count-leading-chars/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/fuzz/count-leading-chars/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/fuzz/heredoc/gobang.go b/tests/fuzz/heredoc/gobang.go new file mode 100644 index 0000000..e4cb9c6 --- /dev/null +++ b/tests/fuzz/heredoc/gobang.go @@ -0,0 +1,30 @@ +package gobang + +import ( + "os" + "testing" + "testing/internal/testdeps" +) + + + +func fn(f *testing.F) { + f.Fuzz(func(t *testing.T, s string) { + Heredoc(s) + }) +} + + + +func MainTest() { + fuzzTargets := []testing.InternalFuzzTarget{ + { "heredoc", fn }, + } + + deps := testdeps.TestDeps{} + tests := []testing.InternalTest {} + benchmarks := []testing.InternalBenchmark{} + examples := []testing.InternalExample {} + m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples) + os.Exit(m.Run()) +} diff --git a/tests/fuzz/heredoc/main.go b/tests/fuzz/heredoc/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/fuzz/heredoc/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file 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) }) |