MCPcopy Create free account
hub / github.com/andybalholm/cascadia / TestParseString

Function TestParseString

parser_test.go:59–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestParseString(t *testing.T) {
60 for source, want := range stringTests {
61 p := &parser{s: source}
62 got, err := p.parseString()
63 if err != nil {
64 if want == "" {
65 // It was supposed to be an error.
66 continue
67 }
68 t.Errorf("parsing %q: got error (%s), want %q", source, err, want)
69 continue
70 }
71
72 if want == "" {
73 if err == nil {
74 t.Errorf("parsing %q: got %q, want error", source, got)
75 }
76 continue
77 }
78
79 if p.i < len(source) {
80 t.Errorf("parsing %q: %d bytes left over", source, len(source)-p.i)
81 continue
82 }
83
84 if got != want {
85 t.Errorf("parsing %q: got %q, want %q", source, got, want)
86 }
87 }
88}

Callers

nothing calls this directly

Calls 1

parseStringMethod · 0.95

Tested by

no test coverage detected