diff --git a/go/cmd/dolt/commands/ci/dolt_test_step_view.go b/go/cmd/dolt/commands/ci/dolt_test_step_view.go index 581b843331..8f2b0a951f 100644 --- a/go/cmd/dolt/commands/ci/dolt_test_step_view.go +++ b/go/cmd/dolt/commands/ci/dolt_test_step_view.go @@ -15,11 +15,11 @@ package ci import ( - "fmt" - "strings" + "fmt" + "strings" - "github.com/dolthub/dolt/go/libraries/doltcore/env/actions/dolt_ci" - dtablefunctions "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtablefunctions" + "github.com/dolthub/dolt/go/libraries/doltcore/env/actions/dolt_ci" + dtablefunctions "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dtablefunctions" ) // previewDoltTestStatements returns the SQL queries that would be executed by dolt_test_run @@ -68,12 +68,17 @@ func buildPreviewSelectors(dt *dolt_ci.DoltTestStep) []string { return []string{"*"} } +// makePreviewStatements constructs human-readable SQL statements that illustrate how +// dolt_test_run would be invoked for each selector. These are for preview output only +// (e.g., `dolt ci view`) and are not executed. We intentionally return the final +// interpolated strings to make the preview easy to read. func makePreviewStatements(selectors []string) []string { - fn := (&dtablefunctions.TestsRunTableFunction{}).Name() - stmts := make([]string, 0, len(selectors)) - for _, s := range selectors { - esc := strings.ReplaceAll(s, "'", "''") - stmts = append(stmts, fmt.Sprintf("SELECT * FROM %s('%s')", fn, esc)) - } - return stmts + fn := (&dtablefunctions.TestsRunTableFunction{}).Name() + stmts := make([]string, 0, len(selectors)) + for _, s := range selectors { + // Escape single quotes for display; this is a preview string, not executed SQL. + esc := strings.ReplaceAll(s, "'", "''") + stmts = append(stmts, fmt.Sprintf("SELECT * FROM %s('%s')", fn, esc)) + } + return stmts }