Skip to content

Commit

Permalink
lua: add a simple test for both vis.pipe variants
Browse files Browse the repository at this point in the history
  • Loading branch information
fischerling committed Sep 8, 2024
1 parent 2efe3f3 commit d06a99a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/lua/pipe.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
24 changes: 24 additions & 0 deletions test/lua/pipe.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d06a99a

Please sign in to comment.