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

Function testCreateStatement

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

Source from the content-addressed store, hash-verified

39}
40
41func 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
71func TestParseInsertCommand(t *testing.T) {
72 tests := []struct {

Callers 1

TestParserCreateCommandFunction · 0.85

Calls 3

stringArrayEqualsFunction · 0.85
tokenArrayEqualsFunction · 0.85
TokenLiteralMethod · 0.65

Tested by

no test coverage detected