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

Function testOrderByCommands

parser/parser_test.go:1018–1038  ·  view source on GitHub ↗
(t *testing.T, expectedOrderByCommand ast.OrderByCommand, actualOrderByCommand *ast.OrderByCommand)

Source from the content-addressed store, hash-verified

1016}
1017
1018func testOrderByCommands(t *testing.T, expectedOrderByCommand ast.OrderByCommand, actualOrderByCommand *ast.OrderByCommand) {
1019
1020 if expectedOrderByCommand.Token.Type != actualOrderByCommand.Token.Type {
1021 t.Errorf("Expecting Token TokenType: %q, got: %q", expectedOrderByCommand.Token.Type, actualOrderByCommand.Token.Type)
1022 }
1023 if expectedOrderByCommand.Token.Literal != actualOrderByCommand.Token.Literal {
1024 t.Errorf("Expecting Token Literal: %s, got: %s", expectedOrderByCommand.Token.Literal, actualOrderByCommand.Token.Literal)
1025 }
1026 if len(expectedOrderByCommand.SortPatterns) != len(actualOrderByCommand.SortPatterns) {
1027 t.Errorf("Expecting Sorting Pattern Array to have: %d elements, got: %d", len(expectedOrderByCommand.SortPatterns), len(actualOrderByCommand.SortPatterns))
1028 }
1029
1030 for i, expectedSortPattern := range expectedOrderByCommand.SortPatterns {
1031 if expectedSortPattern.Order.Literal != actualOrderByCommand.SortPatterns[i].Order.Literal {
1032 t.Errorf("Expecting Order: %s, got: %s", expectedSortPattern.Order.Literal, actualOrderByCommand.SortPatterns[i].Order.Literal)
1033 }
1034 if expectedSortPattern.ColumnName.Literal != expectedOrderByCommand.SortPatterns[i].ColumnName.Literal {
1035 t.Errorf("Expecting Column Name: %s, got: %s", expectedSortPattern.ColumnName.Literal, actualOrderByCommand.SortPatterns[i].ColumnName.Literal)
1036 }
1037 }
1038}
1039
1040func testLimitCommands(t *testing.T, expectedLimitCommand ast.LimitCommand, actualLimitCommand *ast.LimitCommand) {
1041

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected