v0.0.75
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package cmdext
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestStdout(t *testing.T) {
|
||||
|
||||
@@ -57,3 +60,27 @@ func TestStdcombined(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestPartialRead(t *testing.T) {
|
||||
res1, err := Runner("python").
|
||||
Arg("-c").
|
||||
Arg("import sys; import time; print(\"first message\", flush=True); time.sleep(5); print(\"cant see me\", flush=True);").
|
||||
Timeout(100 * time.Millisecond).
|
||||
Run()
|
||||
if err != nil {
|
||||
t.Errorf("%v", err)
|
||||
}
|
||||
if !res1.CommandTimedOut {
|
||||
t.Errorf("!CommandTimedOut")
|
||||
}
|
||||
if res1.StdErr != "" {
|
||||
t.Errorf("res1.StdErr == '%v'", res1.StdErr)
|
||||
}
|
||||
if res1.StdOut != "first message\n" {
|
||||
t.Errorf("res1.StdOut == '%v'", res1.StdOut)
|
||||
}
|
||||
if res1.StdCombined != "first message\n" {
|
||||
t.Errorf("res1.StdCombined == '%v'", res1.StdCombined)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user