go-toml/parse/comment_test.go

22 lines
602 B
Go

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