(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestTokenizer_NextRaw(t *testing.T) { |
| 49 | type Case struct { |
| 50 | input string |
| 51 | expected string |
| 52 | } |
| 53 | |
| 54 | // TODO: Fix the last 2 cases, they're currently hanging. |
| 55 | cases := []Case{ |
| 56 | {input: "foo", expected: "foo"}, |
| 57 | {input: " foo ", expected: "foo"}, |
| 58 | {input: "\" foo \"", expected: " foo "}, |
| 59 | {input: "' foo '", expected: " foo "}, |
| 60 | {input: "` foo `", expected: " foo "}, |
| 61 | // Case{input: "\"foo'bar\"", expected: "foo'bar"}, |
| 62 | // Case{input: "\"()\"", expected: "()"}, |
| 63 | } |
| 64 | |
| 65 | for _, c := range cases { |
| 66 | actual := NewTokenizer(c.input).Next() |
| 67 | expected := &Token{Type: Identifier, Raw: c.expected} |
| 68 | if !reflect.DeepEqual(actual, expected) { |
| 69 | t.Fatalf("\nExpected: %v\n Got: %v", expected, actual) |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | func TestTokenizer_AllSimple(t *testing.T) { |
| 75 | input := ` |
nothing calls this directly
no test coverage detected