Created
November 17, 2015 11:08
-
-
Save meson10/57cc126226dad8c2636f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestComposeNested(t *testing.T) { | |
c1 := NewPipe() | |
c11 := NewComposition(composeOne) | |
c11.SetMessage(StrMap{"merge-one": 1}) | |
c1.Add(c11) | |
c2 := NewPipe() | |
c2.Add(NewFuncComposition(StrMap{"fake-two": 1})) | |
c21 := NewComposition(composeTwo) | |
c21.SetMessage(StrMap{"merge-two": 1}) | |
c2.Add(c21) | |
c1.Add(c2) | |
msg, _ := c1.Execute(makeMessage(StrMap{"input": 1}), engine) | |
expected := StrMap{} | |
msg.Unmarshal(&expected) | |
for _, key := range []string{"input", "merge-one", "ack-one", "fake-two", "merge-two", "ack-two"} { | |
if _, ok := expected[key]; !ok { | |
t.Error("Must have", key, "in final output") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment