23 lines
1007 B
Go
23 lines
1007 B
Go
package parser_test
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestComments(t *testing.T) {
|
|
runStatesTs(t, []statesT{
|
|
{"empty comment at end of file", "#", "#()", ""},
|
|
{"empty comment at end of windows line", "#\r\n", "#()", ""},
|
|
{"empty comment at end of unix line", "#\n", "#()", ""},
|
|
{"empty comment with spaces", "# \t \r\n", `#()`, ""},
|
|
{"basic comment", "#chicken", "#(chicken)", ""},
|
|
{"basic comment starting after whitespace", "# \tchicken", "#(chicken)", ""},
|
|
{"basic comment with surrounding whitespace", "#\t cow \t", "#(cow)", ""},
|
|
{"two lines of comments", "# one \r\n#two", "#(one)#(two)", ""},
|
|
{"comment with escape-y chars", `# \xxx/ \u can't escape/`, `#(\xxx/ \u can't escape/)`, ""},
|
|
{"comment with multiple hashes", `#### Just Jack!`, `#(Just Jack!)`, ""},
|
|
{"comment with hashes inside", `# Follow #me2`, `#(Follow #me2)`, ""},
|
|
{"carriage returns in comment", "# \tlexe\r accepts embedded ca\r\riage \returns\r\n", "#(lexe\r accepts embedded ca\r\riage \returns)", ""},
|
|
})
|
|
}
|