(t *testing.T, command ast.Command, expectedTableName string, expectedValuesTokens []token.Token)
| 99 | } |
| 100 | |
| 101 | func testInsertStatement(t *testing.T, command ast.Command, expectedTableName string, expectedValuesTokens []token.Token) bool { |
| 102 | if command.TokenLiteral() != "INSERT" { |
| 103 | t.Errorf("command.TokenLiteral() not 'INSERT'. got=%q", command.TokenLiteral()) |
| 104 | return false |
| 105 | } |
| 106 | |
| 107 | actualInsertCommand, ok := command.(*ast.InsertCommand) |
| 108 | if !ok { |
| 109 | t.Errorf("actualInsertCommand is not %T. got=%T", &ast.InsertCommand{}, command) |
| 110 | return false |
| 111 | } |
| 112 | |
| 113 | if actualInsertCommand.Name.Token.Literal != expectedTableName { |
| 114 | t.Errorf("%s != %s", actualInsertCommand.TokenLiteral(), expectedTableName) |
| 115 | return false |
| 116 | } |
| 117 | |
| 118 | if !tokenArrayEquals(actualInsertCommand.Values, expectedValuesTokens) { |
| 119 | t.Errorf("") |
| 120 | return false |
| 121 | } |
| 122 | |
| 123 | return true |
| 124 | } |
| 125 | |
| 126 | func TestParseSelectCommand(t *testing.T) { |
| 127 | tests := []struct { |
no test coverage detected