...
1
16
17 package runtime
18
19 import (
20 "testing"
21 )
22
23 func TestFmtRawDoc(t *testing.T) {
24 tests := []struct {
25 t, expected string
26 }{
27 {"aaa\n --- asd\n TODO: tooooodo\n toooodoooooo\n", "aaa"},
28 {"aaa\nasd\n TODO: tooooodo\nbbbb\n --- toooodoooooo\n", "aaa asd bbbb"},
29 {" TODO: tooooodo\n", ""},
30 {"Par1\n\nPar2\n\n", "Par1\\n\\nPar2"},
31 {"", ""},
32 {" ", ""},
33 {" \n", ""},
34 {" \n\n ", ""},
35 {"Example:\n\tl1\n\t\tl2\n", "Example:\\n\\tl1\\n\\t\\tl2"},
36 }
37
38 for _, test := range tests {
39 if o := fmtRawDoc(test.t); o != test.expected {
40 t.Fatalf("Expected: %q, got %q", test.expected, o)
41 }
42 }
43 }
44
View as plain text