summaryrefslogtreecommitdiff
path: root/test/behaviour/settings.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour/settings.zig')
-rw-r--r--test/behaviour/settings.zig17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig
index 9a14ff50..c4d93419 100644
--- a/test/behaviour/settings.zig
+++ b/test/behaviour/settings.zig
@@ -257,8 +257,21 @@ test "settings: every on/off setting the root ctl reads flips when its word is w
const word, const was = .{ line[0..space], line[space + 1 ..] };
const on = std.mem.eql(u8, was, "on");
if (!on and !std.mem.eql(u8, was, "off")) continue;
- try s.write("/ctl", s.at("{s}\n", .{word}));
- try std.testing.expectEqualStrings(s.at("{s} {s}", .{ word, if (on) "off" else "on" }), try setting(&s, word));
+ // Shader's and Pet's `off` say they have no file and no pet; each takes
+ // a name, not a flip.
+ if (std.mem.eql(u8, word, "Shader") or std.mem.eql(u8, word, "Pet")) continue;
+ s.write("/ctl", s.at("{s}\n", .{word})) catch |err| {
+ std.debug.print("a bare {s} (was {s}) was refused\n", .{ word, was });
+ return err;
+ };
+ // A bare word moves the setting: a toggle to its other side, one with
+ // more states (Lift's auto, Crt's level, ShaderAnimation's always) to
+ // the next, never nowhere.
+ const after = try setting(&s, word);
+ try std.testing.expect(std.mem.startsWith(u8, after, word));
+ try std.testing.expect(!std.mem.eql(u8, after, line));
+ if (on) try std.testing.expect(!std.mem.endsWith(u8, after, " on"));
+ if (!on) try std.testing.expect(!std.mem.endsWith(u8, after, " off"));
flipped += 1;
}
try std.testing.expect(flipped > 20);