MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestExtractFunctions_MultipleFunctions

Function TestExtractFunctions_MultipleFunctions

pkg/gosqlx/extract_test.go:464–476  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

462}
463
464func TestExtractFunctions_MultipleFunctions(t *testing.T) {
465 sql := "SELECT COUNT(*), AVG(salary), MAX(age), MIN(created_at) FROM users"
466 astNode, err := Parse(sql)
467 if err != nil {
468 t.Fatalf("Failed to parse SQL: %v", err)
469 }
470
471 functions := ExtractFunctions(astNode)
472 expected := []string{"COUNT", "AVG", "MAX", "MIN"}
473 if !stringSlicesEqual(functions, expected) {
474 t.Errorf("Expected functions %v, got %v", expected, functions)
475 }
476}
477
478func TestExtractFunctions_StringFunctions(t *testing.T) {
479 sql := "SELECT UPPER(name), LOWER(email), SUBSTRING(address, 1, 10) FROM users"

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.85
ExtractFunctionsFunction · 0.85
stringSlicesEqualFunction · 0.70
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected