MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / TestSyntaxErrorLineNum

Function TestSyntaxErrorLineNum

server/webdav/internal/xml/xml_test.go:573–586  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

571}
572
573func TestSyntaxErrorLineNum(t *testing.T) {
574 testInput := "<P>Foo<P>\n\n<P>Bar</>\n"
575 d := NewDecoder(strings.NewReader(testInput))
576 var err error
577 for _, err = d.Token(); err == nil; _, err = d.Token() {
578 }
579 synerr, ok := err.(*SyntaxError)
580 if !ok {
581 t.Error("Expected SyntaxError.")
582 }
583 if synerr.Line != 3 {
584 t.Error("SyntaxError didn't have correct line number.")
585 }
586}
587
588func TestTrailingRawToken(t *testing.T) {
589 input := `<FOO></FOO> `

Callers

nothing calls this directly

Calls 3

TokenMethod · 0.95
NewDecoderFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected