const std = @import("std"); const testing = std.testing; const src = @import("src"); // Test that logs command module can be imported and has expected structure test "logs command module structure" { // Verify the logs module is exported from commands _ = src.commands.logs; // Test basic string operations used in logs command const test_target = "abc123"; try testing.expect(test_target.len > 0); try testing.expect(std.ascii.isAlphanumeric(test_target[0])); } // Test logs command argument parsing patterns test "logs command argument parsing" { const test_cases = [_]struct { args: []const []const u8, expect_target: []const u8, expect_follow: bool, expect_tail: ?usize, }{ .{ .args = &[_][]const u8{"abc123"}, .expect_target = "abc123", .expect_follow = false, .expect_tail = null }, .{ .args = &[_][]const u8{ "abc123", "-f" }, .expect_target = "abc123", .expect_follow = true, .expect_tail = null }, .{ .args = &[_][]const u8{ "abc123", "--follow" }, .expect_target = "abc123", .expect_follow = true, .expect_tail = null }, .{ .args = &[_][]const u8{ "abc123", "-n", "100" }, .expect_target = "abc123", .expect_follow = false, .expect_tail = 100 }, .{ .args = &[_][]const u8{ "abc123", "--tail", "50" }, .expect_target = "abc123", .expect_follow = false, .expect_tail = 50 }, }; for (test_cases) |case| { // Verify target is first argument try testing.expect(std.mem.eql(u8, case.args[0], case.expect_target)); // Check for follow flag var has_follow = false; for (case.args) |arg| { if (std.mem.eql(u8, arg, "-f") or std.mem.eql(u8, arg, "--follow")) { has_follow = true; break; } } try testing.expect(has_follow == case.expect_follow); } } // Test target ID validation patterns (common to both logs and debug) test "target ID validation for logs" { const valid_targets = [_][]const u8{ "abc123", "task-123", "run-abc-456", "abc123def4567890", // long hex-like }; for (valid_targets) |target| { // All valid targets should be non-empty try testing.expect(target.len > 0); // Should not contain spaces try testing.expect(std.mem.indexOf(u8, target, " ") == null); } } // Test that commands.zig properly exports logs and debug modules test "commands module exports" { // Verify logs module is exported _ = src.commands.logs; }