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

Function TestListConstant

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

Source from the content-addressed store, hash-verified

439}
440
441func TestListConstant(t *testing.T) {
442 elems := []Constant{Number(-42), String("foo")}
443 c := List(elems)
444 var out []Constant
445 err1, err2 := c.ListValues(func(elem Constant) error {
446 out = append(out, elem)
447 return nil
448 }, func() error { return nil })
449 if err1 != nil {
450 t.Fatal(err1)
451 }
452 if err2 != nil {
453 t.Fatal(err2)
454 }
455 compareFn := func(left, right Constant) bool {
456 return left.Equals(right)
457 }
458 if !cmp.Equal(out, elems, cmp.Comparer(compareFn)) {
459 t.Errorf("not equal %v and %v", out, elems)
460 }
461}
462
463func TestBasicData(t *testing.T) {
464 tests := []struct {

Callers

nothing calls this directly

Calls 5

NumberFunction · 0.85
StringFunction · 0.85
ListFunction · 0.85
ListValuesMethod · 0.80
EqualsMethod · 0.65

Tested by

no test coverage detected