MCPcopy Index your code
hub / github.com/google/mangle / TestStringConcatenate

Function TestStringConcatenate

functional/functional_test.go:759–780  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

757}
758
759func TestStringConcatenate(t *testing.T) {
760 tests := []struct {
761 input []ast.BaseTerm
762 want ast.Constant
763 }{
764 {[]ast.BaseTerm{}, ast.String("")},
765 {[]ast.BaseTerm{ast.String("abc")}, ast.String("abc")},
766 {[]ast.BaseTerm{ast.String("abc"), ast.String("123")}, ast.String("abc123")},
767 {[]ast.BaseTerm{ast.Float64(3.14)}, ast.String("3.14")},
768 {[]ast.BaseTerm{ast.Number(42)}, ast.String("42")},
769 }
770 for _, test := range tests {
771 term := ast.ApplyFn{symbols.StringConcatenate, test.input}
772 got, err := EvalExpr(term, ast.ConstSubstMap{})
773 if err != nil {
774 t.Fatal(err)
775 }
776 if got != test.want {
777 t.Errorf("EvalExpr(%v)=%v want %v.", term, got, test.want)
778 }
779 }
780}
781
782func TestStringReplace(t *testing.T) {
783 tests := []struct {

Callers

nothing calls this directly

Calls 4

StringFunction · 0.92
Float64Function · 0.92
NumberFunction · 0.92
EvalExprFunction · 0.85

Tested by

no test coverage detected