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

Function testInsertStatement

parser/parser_test.go:101–124  ·  view source on GitHub ↗
(t *testing.T, command ast.Command, expectedTableName string, expectedValuesTokens []token.Token)

Source from the content-addressed store, hash-verified

99}
100
101func 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
126func TestParseSelectCommand(t *testing.T) {
127 tests := []struct {

Callers 1

TestParseInsertCommandFunction · 0.85

Calls 2

tokenArrayEqualsFunction · 0.85
TokenLiteralMethod · 0.65

Tested by

no test coverage detected