diff options
Diffstat (limited to 'test/behaviour/settings.zig')
| -rw-r--r-- | test/behaviour/settings.zig | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index 80573e2f..fdb37fa3 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -207,41 +207,15 @@ fn keywordsIn(s: *Session, want: []const u8) !usize { return seen; } -test "settings: Colors off draws a source plain, and on again colours its keywords, the layout as it was, an edit made while off included" { - if (!syntax) return error.SkipZigTest; - for ([_]bool{ false, true }) |edit_while_off| { - var s = try Session.initFile(std.testing.allocator, "pub fn first() void { if (true) {} }\n"); - defer s.deinit(); - const n = try s.focused(); - try s.write(s.at("/pane/{d}/name", .{n}), "/colors.zig\n"); - var ident: []const u8 = "first"; - if (edit_while_off) { - try std.testing.expect(!std.mem.eql(u8, try styleOf(&s, " fn ", 1), try styleOf(&s, "first", 0))); - try s.write("/ctl", "Colors off\n"); - try s.replace(s.at("/pane/{d}/body", .{n}), "pub fn edited() void { if (false) {} }\n"); - ident = "edited"; - } else try s.write("/ctl", "Colors off\n"); - try std.testing.expectEqual(@as(usize, 2), try keywordsIn(&s, try styleOf(&s, ident, 0))); - const layout = try s.read("/layout"); - try s.write("/ctl", "Colors on\n"); - try s.expect("/layout", layout); - const kw = try styleOf(&s, " fn ", 1); - try std.testing.expect(!std.mem.eql(u8, kw, try styleOf(&s, ident, 0))); - try std.testing.expect(!has(kw, "\"bold\":true")); - try std.testing.expectEqual(@as(usize, 2), try keywordsIn(&s, kw)); - } -} - -test "settings: SyntaxBold keywords stay coloured and bold in every row a pane grows into" { +test "settings: keywords stay coloured in every row a pane grows into" { if (!syntax) return error.SkipZigTest; var s = try Session.initFile(std.testing.allocator, std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); defer s.deinit(); try s.write(s.at("/pane/{d}/name", .{try s.focused()}), "/resize.zig\n"); - try s.write("/ctl", "SyntaxBold on\n"); s.detach(); try s.write("/ctl", "size 80 8\n"); const kw = try styleOf(&s, " fn ", 1); - try std.testing.expect(has(kw, "\"bold\":true")); + try std.testing.expect(!std.mem.eql(u8, kw, try styleOf(&s, "f()", 0))); for ([_]usize{ 50, 12, 70 }) |rows| { try s.write("/ctl", s.at("size 80 {d}\n", .{rows})); try std.testing.expect(try keywordsIn(&s, kw) >= 2 * (rows - 4)); @@ -272,9 +246,9 @@ test "settings: every on/off setting the root ctl reads flips when its word is w flipped += 1; } // A floor, so a ctl that lists none fails: a bare session's on/off - // words, Colors to PagerColor, are ten. - try std.testing.expect(flipped >= 10); - for ([_][]const u8{ "Colors off", "Wrap off", "Debug on" }) |want| + // words, Wrap, Debug, Verbose and JumpTrail at least, are four. + try std.testing.expect(flipped >= 4); + for ([_][]const u8{ "Wrap off", "Debug on" }) |want| try std.testing.expectEqualStrings(want, try setting(&s, want[0..std.mem.indexOfScalar(u8, want, ' ').?])); try s.write("/ctl", "Theme acme\n"); try s.write("/ctl", "Shell /bin/sh\n"); @@ -289,7 +263,7 @@ fn look(s: *Session, style: []const u8) !struct { bool, []const u8 } { return .{ json.object.get("bold").?.bool, try std.json.Stringify.valueAlloc(a, json.object.get("fg").?, .{}) }; } -test "settings: a keyword is coloured apart from the text beside it, and not bold (SyntaxBold is off by default), at a long file's end" { +test "settings: a keyword is coloured apart from the text beside it, and not bold, at a long file's end" { var s = try Session.initFile(std.testing.allocator, "initial\n"); defer s.deinit(); const n = try s.focused(); |
