summaryrefslogtreecommitdiff
path: root/src/file_watch.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_watch.zig')
-rw-r--r--src/file_watch.zig11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig
index 6c746e74..46764a73 100644
--- a/src/file_watch.zig
+++ b/src/file_watch.zig
@@ -687,11 +687,14 @@ test "restored file watches preserve snapshots and accept later disk changes" {
else => {},
};
try std.testing.expect(armed and watches[id] != null);
- try std.testing.expectEqualStrings("restored snapshot\n", pane.file.?.content);
+ // A clean pane's text is its file's, read at the Restore: a dump
+ // that kept other text (an older dump) is not what comes back.
+ const restored: []const u8 = if (case.dirty) "restored snapshot\n" else "disk baseline\n";
+ try std.testing.expectEqualStrings(restored, pane.file.?.content);
try std.testing.expectEqual(@as(usize, 0), pane.file.?.history.undo_len);
try std.testing.expectEqual(case.dirty, pane.file.?.revision != pane.file.?.saved_revision);
_ = reloadChanged(core, io, gpa, &watches);
- try std.testing.expectEqualStrings("restored snapshot\n", pane.file.?.content);
+ try std.testing.expectEqualStrings(restored, pane.file.?.content);
try tmp.dir.writeFile(io, .{ .sub_path = "watched", .data = "later disk save\n" });
_ = reloadChanged(core, io, gpa, &watches);
@@ -704,9 +707,9 @@ test "restored file watches preserve snapshots and accept later disk changes" {
}
try std.testing.expectEqualStrings("later disk save\n", pane.file.?.content);
pardes.panes.File.undo(core, pane);
- try std.testing.expectEqualStrings("restored snapshot\n", pane.file.?.content);
+ try std.testing.expectEqualStrings(restored, pane.file.?.content);
_ = reloadChanged(core, io, gpa, &watches);
- try std.testing.expectEqualStrings("restored snapshot\n", pane.file.?.content);
+ try std.testing.expectEqualStrings(restored, pane.file.?.content);
}
}