summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/replica.zig')
-rw-r--r--core/replica.zig28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig
index ab805cda..80b3ab10 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -5645,3 +5645,31 @@ test "a far client's click into a shell whose program asked for focus events is
try std.testing.expectEqual(@as(u32, 2), r.stats.fast);
try agrees(a, r);
}
+
+test "a far client's own Look of ~/x, bare Shell and a word that runs in the session's directory read the session's facts: its speculation asks its own machine's environment nothing" {
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host(), false);
+ defer a.deinit();
+ const r = try joinedFresh(a);
+ defer r.deinit();
+ try std.testing.expectEqualStrings(a.core.sessionShell(), r.core().sessionShell());
+ try std.testing.expectEqualStrings(a.core.sessionDir(), r.core().sessionDir());
+ for ([_][]const u8{ "Look ~/x", "Shell", "Tutor" }) |cmd| {
+ _ = try r.input(.{ .command = cmd });
+ // What it recorded: applied, its speculation's; stopped, the tape's
+ // last (a speculation runs to its end, stopped or not).
+ const records = if (r.applied > 0) r.pending.items[0].spec.? else r.t.buf.items;
+ var records_text: std.Io.Writer.Allocating = .init(gpa);
+ defer records_text.deinit();
+ tape.describe(records, &records_text.writer);
+ if (std.mem.indexOf(u8, records_text.written(), "host env\n") != null) {
+ std.debug.print("{s} read the environment:\n{s}", .{ cmd, records_text.written() });
+ return error.ReadTheEnvironment;
+ }
+ r.toConfirmed();
+ for (r.pending.items) |p| r.freePending(p);
+ r.pending.clearRetainingCapacity();
+ r.blocked = null;
+ r.dirty = false;
+ }
+}