-
-
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.
Merge pull request #155 from skx/154-integration
154 integration tests
- Loading branch information
Showing
12 changed files
with
291 additions
and
28 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
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package consoleout | ||
|
||
import ( | ||
"io" | ||
"os" | ||
) | ||
|
||
// OutputLoggingDriver holds our state. | ||
type OutputLoggingDriver struct { | ||
|
||
// writer is where we send our output | ||
writer io.Writer | ||
|
||
// history stores our history | ||
history string | ||
} | ||
|
||
// GetName returns the name of this driver. | ||
// | ||
// This is part of the OutputDriver interface. | ||
func (ol *OutputLoggingDriver) GetName() string { | ||
return "logger" | ||
} | ||
|
||
// PutCharacter writes the specified character to the console, | ||
// as this is a recording-driver nothing happens and instead the output | ||
// is discarded saved into our history | ||
// | ||
// This is part of the OutputDriver interface. | ||
func (ol *OutputLoggingDriver) PutCharacter(c uint8) { | ||
ol.history += string(c) | ||
} | ||
|
||
// SetWriter will update the writer. | ||
func (ol *OutputLoggingDriver) SetWriter(w io.Writer) { | ||
ol.writer = w | ||
} | ||
|
||
// GetOutput returns our history. | ||
// | ||
// This is part of the ConsoleRecorder interface. | ||
func (ol *OutputLoggingDriver) GetOutput() string { | ||
return ol.history | ||
} | ||
|
||
// Reset truncates our saved history. | ||
// | ||
// This is part of the ConsoleRecorder interface. | ||
func (ol *OutputLoggingDriver) Reset() { | ||
ol.history = "" | ||
} | ||
|
||
// init registers our driver, by name. | ||
func init() { | ||
Register("logger", func() ConsoleDriver { | ||
return &OutputLoggingDriver{ | ||
writer: os.Stdout, | ||
} | ||
}) | ||
} |
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
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
Oops, something went wrong.