diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 10:29:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 10:36:28 -0300 |
| commit | d3f60c930db06b540bb196b6323a88045e746bbf (patch) | |
| tree | beb8aa1a92d20c6d7ae85c45ac50d53f9e89add0 /src/ninep | |
| parent | 040620344ee8901582d944dbd04f8167f0a6cbc0 (diff) | |
| download | pardes-d3f60c930db06b540bb196b6323a88045e746bbf.tar.gz pardes-d3f60c930db06b540bb196b6323a88045e746bbf.zip | |
The init file reads past a UTF-8 BOM, and every line it fails is said and logged with its line number, never silent
A BOM made the first word unknown, a word no builtin has was skipped
without a word, and a setting that refused its value said nothing (the
init file ran with announcing off). Each failing line now leaves a
notice and an `err - init file line N: <why>` record; `#` still starts
a comment only at a line's start, so `#ff0000` stays a value.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 697ef594..2fa0cd7e 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -4467,3 +4467,13 @@ test "a Mount of a socket path that is not there says no such socket, ENOENT" { try testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len); try testing.expectEqual(E.INVAL, wr(p, @intFromEnum(tree.TopFile.ctl), "Mount peer rel/x.sock\n").errno()); } + +test "the init file reads past a BOM, and every line it fails is a notice and an err, never silent" { + const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .startup_config = "\xEF\xBB\xBFTheme dusk\nnosuchword 1\nTheme nosuchtheme\n# a comment\nInactiveDim 30 # not a comment, a bad value\n" }); + defer p.deinit(); + try testing.expectEqualStrings("dusk", p.theme().name); + try testing.expect(th.logHas(p, "err - init file line 2: unknown word \"nosuchword 1\"")); + try testing.expect(th.logHas(p, "err - init file line 3: ")); + try testing.expect(!th.logHas(p, "line 4")); + try testing.expect(th.logHas(p, "err - init file line 5: ")); +} |
