- require.Eventually(t, func() bool {
- return strings.Contains(c.Output(), text)
- }, 10*time.Second, time.Millisecond, "output so far: %q", c.Output())
+ defer func() {
+ require.NoError(t, unix.Close(fd))
+ }()
+
+ require.NoError(t, unix.IoctlSetWinsize(fd, unix.TIOCSWINSZ, &unix.Winsize{Col: 12}))
+
+ out := TerminalTestOutput{fd: fd}
+ require.Equal(t, 12, terminalColumns(&out))
+ terminalTestShowEvents(t, &out,
+ Event{
+ Kind: "reply",
+ Text: "**first next last**",
+ },
+ Event{
+ Kind: "work",
+ Text: "[BlueBird]\n# Report",
+ },
+ Event{
+ Kind: "tool",
+ Text: "**raw tool**",
+ },
+ Event{
+ Kind: "echo",
+ Text: "**raw result**",
+ },
+ Event{
+ Kind: "error",
+ Text: "**raw error**",
+ },
+ Event{
+ Kind: "notice",
+ Text: "**raw notice**",
+ },
+ Event{
+ Kind: "user",
+ Text: "**raw input**",
+ Source: "telegram",
+ },
+ Event{
+ Kind: "ready",
+ Text: "**raw agent**",
+ },
+ Event{
+ Kind: "subagent",
+ Text: "BlueBird",
+ },
+ Event{Kind: "busy"},
+ Event{Kind: "idle"},
+ )
+ require.Equal(t, "\x1b[1mfirst next\x1b[0m\n\x1b[1mlast\x1b[0m\n[BlueBird]\n\x1b[1mReport\x1b[0m\n"+
+ "[tool] **raw tool**\n[result] **raw result**\n[error] **raw error**\n**raw notice**\n[telegram] **raw input**\n"+
+ "[connected to **raw agent**]\n[BlueBird] started\n[working]\n[done]\n", out.String())