MCPcopy Create free account
hub / github.com/LissaGreense/GO4SQL / testSelectStatement

Function testSelectStatement

parser/parser_test.go:888–916  ·  view source on GitHub ↗
(t *testing.T, command ast.Command, expectedTableName string, expectedSpaces []ast.Space, expectedDistinct bool)

Source from the content-addressed store, hash-verified

886}
887
888func 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
918func testUpdateStatement(t *testing.T, command ast.Command, expectedTableName string, expectedChanges map[token.Token]ast.Anonymitifier) bool {
919 if command.TokenLiteral() != "UPDATE" {

Calls 2

spaceArrayEqualsFunction · 0.85
TokenLiteralMethod · 0.65

Tested by

no test coverage detected