| 10 | ) |
| 11 | |
| 12 | func TestErrors(t *testing.T) { |
| 13 | tests := []struct { |
| 14 | in, out string |
| 15 | }{ |
| 16 | {"", "x"}, |
| 17 | {"x", ""}, |
| 18 | {"var x int = 5\n", "var x = 5\n"}, |
| 19 | {"these are \"one\" thing", "those are 'another' thing"}, |
| 20 | } |
| 21 | for _, test := range tests { |
| 22 | m, err := Compute([]byte(test.in), []byte(test.out)) |
| 23 | if err != nil { |
| 24 | t.Logf("Got expected error: %v", err) |
| 25 | continue |
| 26 | } |
| 27 | t.Errorf("Compute(%q, %q): got %+v, wanted error", test.in, test.out, m) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func TestMatching(t *testing.T) { |
| 32 | // The input is a source text that will be rearranged by the formatter. |