MCPcopy
hub / github.com/google/mangle / TestNumberToString

Function TestNumberToString

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

Source from the content-addressed store, hash-verified

603}
604
605func TestNumberToString(t *testing.T) {
606 tests := []struct {
607 input []ast.BaseTerm
608 want ast.Constant
609 }{
610 {[]ast.BaseTerm{ast.Number(123)}, ast.String("123")},
611 {[]ast.BaseTerm{ast.Number(-42)}, ast.String("-42")},
612 }
613
614 for _, test := range tests {
615 term := ast.ApplyFn{symbols.NumberToString, test.input}
616 got, err := EvalExpr(term, ast.ConstSubstMap{})
617 if err != nil {
618 t.Fatal(err)
619 }
620 if got != test.want {
621 t.Errorf("EvalExpr(%v)=%v want %v.", term, got, test.want)
622 }
623 }
624}
625
626func TestNumberToStringFailure(t *testing.T) {
627 tests := [][]ast.BaseTerm{

Callers

nothing calls this directly

Calls 3

NumberFunction · 0.92
StringFunction · 0.92
EvalExprFunction · 0.85

Tested by

no test coverage detected