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

Function TestBasicData

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

Source from the content-addressed store, hash-verified

461}
462
463func TestBasicData(t *testing.T) {
464 tests := []struct {
465 name string
466 subst Subst
467 want []ConstSubstPair
468 }{
469 {
470 name: "tuple",
471 subst: ConstSubstList{
472 {Variable{"X"}, name("/bar")},
473 {Variable{"Y"}, name("/baz")},
474 },
475 want: []ConstSubstPair{
476 {Variable{"X"}, name("/bar")},
477 {Variable{"Y"}, name("/baz")},
478 },
479 },
480 {
481 name: "map",
482 subst: ConstSubstMap{
483 Variable{"X"}: name("/bar"),
484 Variable{"Y"}: name("/baz"),
485 },
486 want: []ConstSubstPair{
487 {Variable{"X"}, name("/bar")},
488 {Variable{"Y"}, name("/baz")},
489 },
490 },
491 }
492 for _, test := range tests {
493 for _, pair := range test.want {
494 if !test.subst.Get(pair.v).Equals(pair.c) {
495 t.Errorf("%s: subst did not yield %v but %v ", test.name, pair.c, test.subst.Get(pair.v))
496 }
497 }
498 }
499}
500
501func TestAddVars(t *testing.T) {
502 tests := []struct {

Callers

nothing calls this directly

Calls 3

nameFunction · 0.70
EqualsMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected