add test for stream --simplejson

This commit is contained in:
Yasuhiro Matsumoto 2017-04-21 00:57:28 +09:00
parent 6c3b27aa4e
commit bb7a3a2892

View File

@ -52,18 +52,30 @@ data: {"content": "bar", "account":{"acct":"BAR"}}
"config": config, "config": config,
} }
go func() { stop := func() {
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
if sig, ok := app.Metadata["signal"]; ok { if sig, ok := app.Metadata["signal"]; ok {
sig.(chan os.Signal) <- os.Interrupt sig.(chan os.Signal) <- os.Interrupt
return return
} }
panic("timeout") panic("timeout")
}() }
var out string
go stop()
app.Run([]string{"mstdn", "stream"}) app.Run([]string{"mstdn", "stream"})
out = buf.String()
if !strings.Contains(out, "FOO@") {
t.Fatalf("%q should be contained in output of command: %v", "FOO@", out)
}
if !strings.Contains(out, "foo") {
t.Fatalf("%q should be contained in output of command: %v", "foo", out)
}
out := buf.String() go stop()
app.Run([]string{"mstdn", "stream", "--simplejson"})
out = buf.String()
if !strings.Contains(out, "FOO@") { if !strings.Contains(out, "FOO@") {
t.Fatalf("%q should be contained in output of command: %v", "FOO@", out) t.Fatalf("%q should be contained in output of command: %v", "FOO@", out)
} }