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

Function TestExtractFunctions_NestedFunctions

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

Source from the content-addressed store, hash-verified

490}
491
492func TestExtractFunctions_NestedFunctions(t *testing.T) {
493 sql := "SELECT UPPER(TRIM(name)) FROM users"
494 astNode, err := Parse(sql)
495 if err != nil {
496 t.Fatalf("Failed to parse SQL: %v", err)
497 }
498
499 functions := ExtractFunctions(astNode)
500 expected := []string{"UPPER", "TRIM"}
501 if !stringSlicesEqual(functions, expected) {
502 t.Errorf("Expected functions %v, got %v", expected, functions)
503 }
504}
505
506func TestExtractFunctions_InWhere(t *testing.T) {
507 sql := "SELECT name FROM users WHERE UPPER(name) = 'JOHN'"

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