diff options
Diffstat (limited to 'runtime/upgrade.zig')
| -rw-r--r-- | runtime/upgrade.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/runtime/upgrade.zig b/runtime/upgrade.zig index 7e376da5..ca788cfc 100644 --- a/runtime/upgrade.zig +++ b/runtime/upgrade.zig @@ -476,7 +476,10 @@ pub fn load(gpa: std.mem.Allocator, core_gpa: std.mem.Allocator, opts: pardes.Op var o = opts; o.load_path = null; const p = try pardes.Pardes.init(core_gpa, o); - p.setMessage(.at(p.view().active), std.fmt.bufPrint(&buf, "Upgrade: no build could load the session ({s}); its shells are here, and Restore {s} brings the rest back", .{ why, again_name[0..@min(again_name.len, 400)] }) catch "Upgrade: no build could load the session; its dump is kept for a Restore"); + // An error, of no pane (tellEveryView): a notice would be retired at + // once by the fresh session's first word's echo (its shell's + // `Term`), and its Restore never read on the notice row. + _ = pardes.Messages.say(p, .@"error", pardes.MAX_PANES, std.fmt.bufPrint(&buf, "Upgrade: no build could load the session ({s}); its shells are here, and Restore {s} brings the rest back", .{ why, again_name[0..@min(again_name.len, 400)] }) catch "Upgrade: no build could load the session; its dump is kept for a Restore"); return p; } } @@ -623,7 +626,7 @@ test "an upgrade from the build before reads the dump file its record names, and try std.testing.expectError(error.FileNotFound, tmp.dir.statFile(std.testing.io, "pardes-upgrade-1.dump", .{})); } -test "an older build's dump named by a path past 4096 bytes is refused in words and kept for a Restore" { +test "an older build's dump named by a path past 4096 bytes is refused in words and kept for a Restore: an error of no pane, which the fresh session's first word's echo leaves on the notice row" { const gpa = std.testing.allocator; var text_buf: [4200]u8 = undefined; var long: [4096]u8 = undefined; @@ -633,8 +636,13 @@ test "an older build's dump named by a path past 4096 bytes is refused in words const q = try load(gpa, gpa, .{ .tty_only = true }, &rec); defer q.deinit(); try std.testing.expect(rec.fresh); - const pane = q.panes[q.view().active].?; - try std.testing.expect(std.mem.indexOf(u8, q.messages.saidBy(pane), "Upgrade: no build could load the session") != null); + // The fresh session's first word (its shell's pane, `Term`) announced, + // an echo, as its host does at its start (exec.zig). + _ = pardes.Messages.say(q, .echo, q.view().active, "Term"); + const said = q.messages.headline() orelse return error.NothingSaid; + try std.testing.expect(std.mem.startsWith(u8, said.words(), "Upgrade: no build could load the session")); + try std.testing.expectEqual(pardes.Messages.Kind.@"error", said.kind); + try std.testing.expectEqual(@as(usize, 0), said.src.len); } test "a newer build installed is said on the notice row in its own words, of no pane: the focused file's path is not its cause" { |
