]> git.giacomolli.uk - onechat/blobdiff - terminal_client_helper_test.go
Return known failures without redundant checks
[onechat] / terminal_client_helper_test.go
index 077d90c6a282def0fd0c4f518a424e8a15af4851..5018e89684d3fa4e1d5bf929a1b8b9286cf5276e 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
@@ -69,7 +70,7 @@ func terminalStartTestClient(t *testing.T, socket string) *TerminalTestClient {
        }()
 
        t.Cleanup(func() {
        }()
 
        t.Cleanup(func() {
-               _ = writer.Close()
+               require.NoError(t, writer.Close())
        })
 
        return client
        })
 
        return client