(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…