codegen: fix test generator hardcoding test string in multiple places
All checks were successful
CI / build-docker (push) Successful in 3s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Successful in 15s

This commit is contained in:
~wispem-wantex 2026-02-14 18:33:41 -08:00
parent f82929f6e2
commit 4e0836eb2e

View File

@ -108,7 +108,7 @@ func GenerateModelTestAST(tbl pkgschema.Table, schema pkgschema.Schema, gomodNam
Rhs: []ast.Expr{
&ast.BasicLit{
Kind: token.STRING,
Value: `"an item"`,
Value: fmt.Sprintf("%q", description1),
},
},
},
@ -148,12 +148,12 @@ func GenerateModelTestAST(tbl pkgschema.Table, schema pkgschema.Schema, gomodNam
})},
},
// assert.Equal(t, "an item", item2.Description)
// assert.Equal(t, item.Description, item2.Description)
&ast.ExprStmt{X: &ast.CallExpr{
Fun: &ast.SelectorExpr{X: ast.NewIdent("assert"), Sel: ast.NewIdent("Equal")},
Args: []ast.Expr{
ast.NewIdent("t"),
&ast.BasicLit{Kind: token.STRING, Value: description1},
&ast.SelectorExpr{X: testObj, Sel: fieldName},
&ast.SelectorExpr{X: testObj2, Sel: fieldName},
},
}},