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

Function TestParseString

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

parseStringMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…