add test for stream --simplejson
This commit is contained in:
parent
6c3b27aa4e
commit
bb7a3a2892
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user