github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/internal/testutil/be_expr.go (about) 1 package testutil 2 3 import ( 4 "context" 5 "strings" 6 "testing" 7 8 "github.com/octohelm/storage/pkg/sqlbuilder" 9 ) 10 11 func ShouldBeExpr(t testing.TB, sqlExpr sqlbuilder.SqlExpr, query string, args ...interface{}) { 12 t.Helper() 13 14 if sqlbuilder.IsNilExpr(sqlExpr) { 15 Expect(t, "", Be(strings.TrimSpace(query))) 16 return 17 } 18 19 expr := sqlExpr.Ex(context.Background()) 20 21 Expect(t, expr.Query(), Be(strings.TrimSpace(query))) 22 Expect(t, expr.Args(), Equal(args)) 23 }