-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wlwanpan
committed
Jan 2, 2021
1 parent
2811036
commit 84917db
Showing
12 changed files
with
160 additions
and
75 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package wrapper | ||
|
||
import ( | ||
"bufio" | ||
"io" | ||
"os" | ||
) | ||
|
||
// testConsole provide a test console implementation of the interface Console, | ||
// that reads from a test log file instead of a running java stdout. This is | ||
// mainly due used for unit tests in test files. | ||
type testConsole struct { | ||
scnr *bufio.Scanner | ||
} | ||
|
||
func (tc *testConsole) Start() error { | ||
return nil | ||
} | ||
|
||
func (tc *testConsole) Kill() error { | ||
return nil | ||
} | ||
|
||
func (tc *testConsole) WriteCmd(c string) error { | ||
return nil | ||
} | ||
|
||
func (tc *testConsole) ReadLine() (string, error) { | ||
if tc.scnr.Scan() { | ||
return tc.scnr.Text(), nil | ||
} | ||
return "", io.EOF | ||
} | ||
|
||
func newTestConsole(filename string) (*testConsole, error) { | ||
file, err := os.Open(filename) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &testConsole{ | ||
scnr: bufio.NewScanner(file), | ||
}, nil | ||
} |
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
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
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
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
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
File renamed without changes.
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
File renamed without changes.
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
Oops, something went wrong.