(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestParse(t *testing.T) { |
| 18 | tests := []struct { |
| 19 | src string |
| 20 | want TestTreeNode |
| 21 | }{ |
| 22 | { |
| 23 | "", |
| 24 | TestTreeNode{ |
| 25 | Type: "Body", |
| 26 | }, |
| 27 | }, |
| 28 | { |
| 29 | "a = 1\n", |
| 30 | TestTreeNode{ |
| 31 | Type: "Body", |
| 32 | Children: []TestTreeNode{ |
| 33 | { |
| 34 | Type: "Attribute", |
| 35 | Children: []TestTreeNode{ |
| 36 | { |
| 37 | Type: "comments", |
| 38 | }, |
| 39 | { |
| 40 | Type: "identifier", |
| 41 | Val: "a", |
| 42 | }, |
| 43 | { |
| 44 | Type: "Tokens", |
| 45 | Val: " =", |
| 46 | }, |
| 47 | { |
| 48 | Type: "Expression", |
| 49 | Children: []TestTreeNode{ |
| 50 | { |
| 51 | Type: "Tokens", |
| 52 | Val: " 1", |
| 53 | }, |
| 54 | }, |
| 55 | }, |
| 56 | { |
| 57 | Type: "comments", |
| 58 | }, |
| 59 | { |
| 60 | Type: "Tokens", |
| 61 | Val: "\n", |
| 62 | }, |
| 63 | }, |
| 64 | }, |
| 65 | }, |
| 66 | }, |
| 67 | }, |
| 68 | { |
| 69 | "# aye aye aye\na = 1\n", |
| 70 | TestTreeNode{ |
| 71 | Type: "Body", |
| 72 | Children: []TestTreeNode{ |
| 73 | { |
| 74 | Type: "Attribute", |
nothing calls this directly
no test coverage detected