package button import ( "testing" ) func TestV01TransformationPipe(t *testing.T) { cases := map[string]struct { input string xform map[string]string want string }{ "empty input": { xform: map[string]string{"a": "bc"}, }, "empty xform": { input: "aa", want: "aa", }, "all": { input: "aa", xform: map[string]string{"a": "cc"}, want: "cc", }, "last": { input: "ba", xform: map[string]string{"a": "cc"}, want: "bc", }, "first": { input: "ab", xform: map[string]string{"a": "cc"}, want: "cb", }, "noop": { input: "bb", xform: map[string]string{"a": "bc"}, want: "bb", }, } for name, d := range cases { c := d t.Run(name, func(t *testing.T) { got := v01Transformation(c.xform).pipe(c.input) if got != c.want { t.Errorf("%+v(%s) want %s got %s", c.xform, c.input, c.want, got) } }) } }