summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/addons.zig8
-rw-r--r--test/behaviour/addons_pdf.zig2
-rw-r--r--test/behaviour/other_files.zig2
3 files changed, 12 insertions, 0 deletions
diff --git a/test/behaviour/addons.zig b/test/behaviour/addons.zig
index 25b1e523..90f4e383 100644
--- a/test/behaviour/addons.zig
+++ b/test/behaviour/addons.zig
@@ -381,6 +381,8 @@ fn dirOf(s: *Session, tmp: *std.testing.TmpDir) ![]const u8 {
test "addons: a picker shows a file of an addon's kind through its kind in the pane it lands in, Esc puts that pane back as it was, and Enter lands as a Look does" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "seven.fake", .data = "1234567" });
var s = try Session.initFile(std.testing.allocator, "x\n");
@@ -421,6 +423,8 @@ test "addons: a picker shows a file of an addon's kind through its kind in the p
test "addons: a picker's row of a file no kind takes and not text shows one line naming it, and the row before's file never stays in the body" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "other.txt", .data = "other text\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "seven.fake", .data = "1234567" });
@@ -462,6 +466,8 @@ test "addons: a picker's row of a file no kind takes and not text shows one line
test "addons: moving the cursor over pictures in a picker draws only the one it rests on, and a draw of one passed by is dropped whenever it comes back" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
const png = "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\x0cIDATx\x9cc\xf8\xcf\xc0\x00\x00\x03\x01\x01\x00\xc9\xfe\x92\xef\x00\x00\x00\x00IEND\xaeB`\x82";
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pic1.png", .data = png });
@@ -499,6 +505,8 @@ test "addons: moving the cursor over pictures in a picker draws only the one it
test "addons: Enter on a picture in a picker opens its kind's pane, never its bytes as text in the reading pane (the user's report)" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pic.ppm", .data = "P6\n2 1\n255\n\x0d\x4d\xe7\x0d\x4d\xe7" });
var s = try Session.initFile(std.testing.allocator, "x\n");
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig
index d773f4e2..eca39012 100644
--- a/test/behaviour/addons_pdf.zig
+++ b/test/behaviour/addons_pdf.zig
@@ -307,6 +307,8 @@ test "addons: a PDF under a picker's cursor shows through the pdf addon in the p
try s.loadPdf();
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
const pdf = try std.Io.Dir.cwd().readFileAlloc(std.testing.io, "docs/design.pdf", s.arena.allocator(), .limited(4 << 20));
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "paper.pdf", .data = pdf });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig
index e6c104c3..8a9016bc 100644
--- a/test/behaviour/other_files.zig
+++ b/test/behaviour/other_files.zig
@@ -25,6 +25,8 @@ test "other-files: kbdin types at the pane with the keyboard and mousein clicks,
test "other-files: kbdin's keys are the user's: SPC f f opens Find's picker in the pane's tag where jumps walk, not the +Search a script's Find opens" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "a.txt", .data = "a\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.txt", .data = "b\n" });
var s = try Session.initFile(std.testing.allocator, "x\n");