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

Function TestStringConstant

ast/ast_test.go:392–415  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

390}
391
392func TestStringConstant(t *testing.T) {
393 tests := []struct {
394 c Constant
395 want string
396 }{
397 {
398 c: String("Lean down your ear upon the earth and listen."),
399 want: "Lean down your ear upon the earth and listen.",
400 },
401 {
402 c: String(`hello world " \\ "`),
403 want: `hello world " \\ "`,
404 },
405 }
406 for _, test := range tests {
407 str, err := test.c.StringValue()
408 if err != nil {
409 t.Fatal(err)
410 }
411 if str != test.want {
412 t.Errorf("want %q got %q", test.want, str)
413 }
414 }
415}
416
417func TestNumberConstant(t *testing.T) {
418 c := Number(-42)

Callers

nothing calls this directly

Calls 2

StringFunction · 0.85
StringValueMethod · 0.80

Tested by

no test coverage detected