(t *testing.T, command ast.Command, expectedTableName string, expectedSpaces []ast.Space, expectedDistinct bool)
| 886 | } |
| 887 | |
| 888 | func testSelectStatement(t *testing.T, command ast.Command, expectedTableName string, expectedSpaces []ast.Space, expectedDistinct bool) bool { |
| 889 | if command.TokenLiteral() != "SELECT" { |
| 890 | t.Errorf("command.TokenLiteral() not 'SELECT'. got=%q", command.TokenLiteral()) |
| 891 | return false |
| 892 | } |
| 893 | |
| 894 | actualSelectCommand, ok := command.(*ast.SelectCommand) |
| 895 | if !ok { |
| 896 | t.Errorf("actualSelectCommand is not %T. got=%T", &ast.SelectCommand{}, command) |
| 897 | return false |
| 898 | } |
| 899 | |
| 900 | if actualSelectCommand.Name.Token.Literal != expectedTableName { |
| 901 | t.Errorf("%s != %s", actualSelectCommand.TokenLiteral(), expectedTableName) |
| 902 | return false |
| 903 | } |
| 904 | |
| 905 | if actualSelectCommand.HasDistinct != expectedDistinct { |
| 906 | t.Errorf("HasDistinct should be set to %t, got=%t", expectedDistinct, actualSelectCommand.HasDistinct) |
| 907 | return false |
| 908 | } |
| 909 | |
| 910 | if !spaceArrayEquals(actualSelectCommand.Space, expectedSpaces) { |
| 911 | t.Errorf("actualSelectCommand has diffrent space than expected. %+v != %+v", actualSelectCommand.Space, expectedSpaces) |
| 912 | return false |
| 913 | } |
| 914 | |
| 915 | return true |
| 916 | } |
| 917 | |
| 918 | func testUpdateStatement(t *testing.T, command ast.Command, expectedTableName string, expectedChanges map[token.Token]ast.Anonymitifier) bool { |
| 919 | if command.TokenLiteral() != "UPDATE" { |
no test coverage detected