(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func 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 | } |
nothing calls this directly
no test coverage detected