(t *testing.T, command ast.Command, expectedTableName string, expectedColumnNames []string, expectedColumTypes []token.Token)
| 39 | } |
| 40 | |
| 41 | func testCreateStatement(t *testing.T, command ast.Command, expectedTableName string, expectedColumnNames []string, expectedColumTypes []token.Token) bool { |
| 42 | if command.TokenLiteral() != "CREATE" { |
| 43 | t.Errorf("command.TokenLiteral() not 'CREATE'. got=%q", command.TokenLiteral()) |
| 44 | return false |
| 45 | } |
| 46 | |
| 47 | actualCreateCommand, ok := command.(*ast.CreateCommand) |
| 48 | if !ok { |
| 49 | t.Errorf("actualCreateCommand is not %T. got=%T", &ast.CreateCommand{}, command) |
| 50 | return false |
| 51 | } |
| 52 | |
| 53 | if actualCreateCommand.Name.Token.Literal != expectedTableName { |
| 54 | t.Errorf("%s != %s", actualCreateCommand.TokenLiteral(), expectedTableName) |
| 55 | return false |
| 56 | } |
| 57 | |
| 58 | if !stringArrayEquals(actualCreateCommand.ColumnNames, expectedColumnNames) { |
| 59 | t.Errorf("") |
| 60 | return false |
| 61 | } |
| 62 | |
| 63 | if !tokenArrayEquals(actualCreateCommand.ColumnTypes, expectedColumTypes) { |
| 64 | t.Errorf("") |
| 65 | return false |
| 66 | } |
| 67 | |
| 68 | return true |
| 69 | } |
| 70 | |
| 71 | func TestParseInsertCommand(t *testing.T) { |
| 72 | tests := []struct { |
no test coverage detected