graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
chore(tui): split app.zig tests under the 600-line ceiling
Rach Pradhan9155b86efc82
diff --git a/TUI/app.zig b/TUI/app.zigindex 556d6c3c..11e67a65 100644--- a/TUI/app.zig+++ b/TUI/app.zig@@ -573,34 +573,3 @@ fn sanitized(alloc: std.mem.Allocator, text: []const u8) ![]u8 {}return out.toOwnedSlice();}--test "cycleMode walks Normal → Plan → Always-approve" {- var m: Model = undefined;- m.setup(std.testing.allocator);- defer m.deinit();- try std.testing.expectEqual(AgentMode.normal, m.mode);- m.cycleMode();- try std.testing.expectEqual(AgentMode.plan, m.mode);- m.cycleMode();- try std.testing.expectEqual(AgentMode.always_approve, m.mode);-}--test "push user flips welcome to agent" {- var m: Model = undefined;- m.setup(std.testing.allocator);- defer m.deinit();- try std.testing.expectEqual(Screen.welcome, m.screen);- try m.push(.user, "hi");- try std.testing.expectEqual(Screen.agent, m.screen);-}--test "push strips raw ANSI, OSC, and CR from tool text" {- var m: Model = undefined;- m.setup(std.testing.allocator);- defer m.deinit();- try m.push(.tool, "⚙ bash | \x1b[31mred\x1b[0m\x1b]0;title\x07 done\r");- try std.testing.expectEqualStrings("⚙ bash | red done", m.history.items[0].text);- // No ESC and no CR — the old fast path would have kept these.- try m.push(.assistant, "beep\x07back\x08null\x00done");- try std.testing.expectEqualStrings("beepbacknulldone", m.history.items[1].text);-}diff --git a/TUI/app_tests.zig b/TUI/app_tests.zignew file mode 100644index 00000000..9037d73c--- /dev/null+++ b/TUI/app_tests.zig@@ -0,0 +1,38 @@+//! Tests for TUI/app.zig, split out so app.zig stays under 600 lines.++const std = @import("std");+const app = @import("app.zig");+const Model = app.Model;+const AgentMode = app.AgentMode;+const Screen = app.Screen;++test "cycleMode walks Normal → Plan → Always-approve" {+ var m: Model = undefined;+ m.setup(std.testing.allocator);+ defer m.deinit();+ try std.testing.expectEqual(AgentMode.normal, m.mode);+ m.cycleMode();+ try std.testing.expectEqual(AgentMode.plan, m.mode);+ m.cycleMode();+ try std.testing.expectEqual(AgentMode.always_approve, m.mode);+}++test "push user flips welcome to agent" {+ var m: Model = undefined;+ m.setup(std.testing.allocator);+ defer m.deinit();+ try std.testing.expectEqual(Screen.welcome, m.screen);+ try m.push(.user, "hi");+ try std.testing.expectEqual(Screen.agent, m.screen);+}++test "push strips raw ANSI, OSC, and CR from tool text" {+ var m: Model = undefined;+ m.setup(std.testing.allocator);+ defer m.deinit();+ try m.push(.tool, "⚙ bash | \x1b[31mred\x1b[0m\x1b]0;title\x07 done\r");+ try std.testing.expectEqualStrings("⚙ bash | red done", m.history.items[0].text);+ // No ESC and no CR — the old fast path would have kept these.+ try m.push(.assistant, "beep\x07back\x08null\x00done");+ try std.testing.expectEqualStrings("beepbacknulldone", m.history.items[1].text);+}diff --git a/TUI/root.zig b/TUI/root.zigindex 2aa69658..bc3a71ac 100644--- a/TUI/root.zig+++ b/TUI/root.zig@@ -52,6 +52,7 @@ test {_ = theme;_ = catalog;_ = app;+ _ = @import("app_tests.zig");_ = @import("dispatch.zig");_ = @import("prompt_history.zig");_ = @import("meters.zig");