go-toml/comment_test.go

25 lines
870 B
Go

package parser
import (
"testing"
)
func TestComment2(t *testing.T) {
for _, test := range []parseTest{
{``, []string{`Error: unexpected end of file (expected comment) at start of file`}},
{`#`, []string{`comment("#")`}},
{`# `, []string{`comment("# ")`}},
{`# with data`, []string{`comment("# with data")`}},
{"# ending in EOL & EOF\r\n", []string{`comment("# ending in EOL & EOF")`}},
{`# \xxx/ \u can't escape/`, []string{`comment("# \\xxx/ \\u can't escape/")`}},
{"# \tlexe\r accepts embedded ca\r\riage \returns\r\n", []string{
`comment("# \tlexe\r accepts embedded ca\r\riage \returns")`}},
{"# with data and newline\ncode continues here", []string{
`comment("# with data and newline")`,
`Error: unexpected input (expected end of file) at line 2, column 1`}},
} {
p := &parser{}
testParseHandler(t, p, p.startComment, test)
}
}