]> git.giacomolli.uk - onechat/blobdiff - terminal_client_helper_test.go
Check the complete message before committing
[onechat] / terminal_client_helper_test.go
index 077d90c6a282def0fd0c4f518a424e8a15af4851..8dbc646cce516ffbbc57dbf47d99ea5153a8f236 100644 (file)
@@ -1,6 +1,7 @@
 package main
 
 import (
 package main
 
 import (
+       "fmt"
        "io"
        "net"
        "strings"
        "io"
        "net"
        "strings"
@@ -26,11 +27,6 @@ func (c *TerminalTestClient) Type(line string) {
        }
 }
 
        }
 }
 
-// Output returns what the client showed.
-func (c *TerminalTestClient) Output() string {
-       return c.out.String()
-}
-
 // WaitFor waits until the client showed text.
 func (c *TerminalTestClient) WaitFor(t *testing.T, text string) {
        t.Helper()
 // WaitFor waits until the client showed text.
 func (c *TerminalTestClient) WaitFor(t *testing.T, text string) {
        t.Helper()
@@ -40,11 +36,16 @@ func (c *TerminalTestClient) WaitFor(t *testing.T, text string) {
        }, 10*time.Second, time.Millisecond, "output so far: %q", c.Output())
 }
 
        }, 10*time.Second, time.Millisecond, "output so far: %q", c.Output())
 }
 
+// Output returns what the client showed.
+func (c *TerminalTestClient) Output() string {
+       return c.out.String()
+}
+
 // Close ends the input and waits for the client.
 func (c *TerminalTestClient) Close() error {
        err := c.input.Close()
        if err != nil {
 // Close ends the input and waits for the client.
 func (c *TerminalTestClient) Close() error {
        err := c.input.Close()
        if err != nil {
-               return err
+               return fmt.Errorf("close terminal input: %w", err)
        }
 
        return <-c.done
        }
 
        return <-c.done