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

Function TestRoundTrip

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

Source from the content-addressed store, hash-verified

578}
579
580func TestRoundTrip(t *testing.T) {
581 tests := []ast.Atom{
582 evAtom("bar(/abc, 1, 'def')"),
583 evAtom("bar([/abc],1,/def)"),
584 evAtom("bar([/abc, /def], 1, /def)"),
585 evAtom("baz([/abc : 1, /def : 2], 1, /def)"),
586 evAtom("baz({/abc : 1, /def : 2}, 1, /def)"),
587 }
588 for _, test := range tests {
589 atom, err := parse.Atom(test.String())
590 if err != nil {
591 t.Fatal(err)
592 }
593 atom, err = EvalAtom(atom, nil)
594 if err != nil {
595 t.Fatal(err)
596 }
597
598 if !atom.Equals(test) {
599 t.Errorf("(%v).Equals(%v) = false expected true", atom, test)
600
601 }
602 }
603}
604
605func TestNumberToString(t *testing.T) {
606 tests := []struct {

Callers

nothing calls this directly

Calls 5

AtomFunction · 0.92
EvalAtomFunction · 0.85
evAtomFunction · 0.70
StringMethod · 0.65
EqualsMethod · 0.65

Tested by

no test coverage detected