From d06a99a136914311f4518fb3b345ddc9411b7262 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 8 Sep 2024 19:03:54 +0200 Subject: [PATCH] lua: add a simple test for both vis.pipe variants --- test/lua/pipe.in | 1 + test/lua/pipe.lua | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/lua/pipe.in create mode 100644 test/lua/pipe.lua diff --git a/test/lua/pipe.in b/test/lua/pipe.in new file mode 100644 index 000000000..191028156 --- /dev/null +++ b/test/lua/pipe.in @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/test/lua/pipe.lua b/test/lua/pipe.lua new file mode 100644 index 000000000..7b6c80877 --- /dev/null +++ b/test/lua/pipe.lua @@ -0,0 +1,24 @@ +require 'busted.runner'() + +local file = vis.win.file + +describe("vis.pipe", function() + + it("vis.pipe buffer", function() + vis:pipe("foo", "cat > f") + local f = io.open("f", "r") + assert.truthy(f) + assert.are.equal(f:read("*a"), "foo") + f:close() + os.remove("f") + end) + + it("vis.pipe range", function() + vis:pipe(file, {start=0, finish=3}, "cat > f") + local f = io.open("f", "r") + assert.truthy(f) + assert.are.equal(f:read("*a"), "foo") + f:close() + os.remove("f") + end) +end)