File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11package terminal
22
33import (
4+ "errors"
5+ "fmt"
46 "testing"
57 "time"
68
@@ -21,6 +23,27 @@ func TestExitCode(t *testing.T) {
2123 assert .Equal (t , term .ExitCode (), int (- 1 ))
2224}
2325
26+ func testExitCodeN (t * testing.T , n int ) {
27+ term := New ()
28+ term .Resize (fyne .NewSize (45 , 45 ))
29+ go term .RunLocalShell ()
30+ err := errors .New ("NotYet" )
31+ for err != nil {
32+ time .Sleep (50 * time .Millisecond )
33+ _ , err = term .Write ([]byte (fmt .Sprintf ("exit %d\n " , n )))
34+ }
35+ for term .ExitCode () == - 1 {
36+ time .Sleep (50 * time .Millisecond )
37+ }
38+
39+ assert .Equal (t , n , term .ExitCode ())
40+ }
41+
42+ func TestExitCode01 (t * testing.T ) {
43+ testExitCodeN (t , 0 )
44+ testExitCodeN (t , 1 )
45+ }
46+
2447func TestTerminal_Resize (t * testing.T ) {
2548 term := New ()
2649 term .Resize (fyne .NewSize (45 , 45 ))
You can’t perform that action at this time.
0 commit comments