aboutsummaryrefslogtreecommitdiff
path: root/test/unit/buffer_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/buffer_spec.lua')
-rw-r--r--test/unit/buffer_spec.lua27
1 files changed, 14 insertions, 13 deletions
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua
index 49a4d84279..f7124b2782 100644
--- a/test/unit/buffer_spec.lua
+++ b/test/unit/buffer_spec.lua
@@ -1,5 +1,6 @@
-local helpers = require("test.unit.helpers")
+local helpers = require("test.unit.helpers")(after_each)
+local itp = helpers.gen_itp(it)
local to_cstr = helpers.to_cstr
local get_str = helpers.ffi.string
@@ -39,17 +40,17 @@ describe('buffer functions', function()
describe('buf_valid', function()
- it('should view NULL as an invalid buffer', function()
+ itp('should view NULL as an invalid buffer', function()
eq(false, buffer.buf_valid(NULL))
end)
- it('should view an open buffer as valid', function()
+ itp('should view an open buffer as valid', function()
local buf = buflist_new(path1, buffer.BLN_LISTED)
eq(true, buffer.buf_valid(buf))
end)
- it('should view a closed and hidden buffer as valid', function()
+ itp('should view a closed and hidden buffer as valid', function()
local buf = buflist_new(path1, buffer.BLN_LISTED)
close_buffer(NULL, buf, 0, 0)
@@ -57,7 +58,7 @@ describe('buffer functions', function()
eq(true, buffer.buf_valid(buf))
end)
- it('should view a closed and unloaded buffer as valid', function()
+ itp('should view a closed and unloaded buffer as valid', function()
local buf = buflist_new(path1, buffer.BLN_LISTED)
close_buffer(NULL, buf, buffer.DOBUF_UNLOAD, 0)
@@ -65,7 +66,7 @@ describe('buffer functions', function()
eq(true, buffer.buf_valid(buf))
end)
- it('should view a closed and wiped buffer as invalid', function()
+ itp('should view a closed and wiped buffer as invalid', function()
local buf = buflist_new(path1, buffer.BLN_LISTED)
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0)
@@ -84,7 +85,7 @@ describe('buffer functions', function()
return buffer.buflist_findpat(to_cstr(pat), NULL, allow_unlisted, 0, 0)
end
- it('should find exact matches', function()
+ itp('should find exact matches', function()
local buf = buflist_new(path1, buffer.BLN_LISTED)
eq(buf.handle, buflist_findpat(path1, ONLY_LISTED))
@@ -92,7 +93,7 @@ describe('buffer functions', function()
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0)
end)
- it('should prefer to match the start of a file path', function()
+ itp('should prefer to match the start of a file path', function()
local buf1 = buflist_new(path1, buffer.BLN_LISTED)
local buf2 = buflist_new(path2, buffer.BLN_LISTED)
local buf3 = buflist_new(path3, buffer.BLN_LISTED)
@@ -106,7 +107,7 @@ describe('buffer functions', function()
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
end)
- it('should prefer to match the end of a file over the middle', function()
+ itp('should prefer to match the end of a file over the middle', function()
--{ Given: Two buffers, where 'test' appears in both
-- And: 'test' appears at the end of buf3 but in the middle of buf2
local buf2 = buflist_new(path2, buffer.BLN_LISTED)
@@ -130,7 +131,7 @@ describe('buffer functions', function()
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
end)
- it('should match a unique fragment of a file path', function()
+ itp('should match a unique fragment of a file path', function()
local buf1 = buflist_new(path1, buffer.BLN_LISTED)
local buf2 = buflist_new(path2, buffer.BLN_LISTED)
local buf3 = buflist_new(path3, buffer.BLN_LISTED)
@@ -142,7 +143,7 @@ describe('buffer functions', function()
close_buffer(NULL, buf3, buffer.DOBUF_WIPE, 0)
end)
- it('should include / ignore unlisted buffers based on the flag.', function()
+ itp('should include / ignore unlisted buffers based on the flag.', function()
--{ Given: A buffer
local buf3 = buflist_new(path3, buffer.BLN_LISTED)
@@ -169,7 +170,7 @@ describe('buffer functions', function()
--}
end)
- it('should prefer listed buffers to unlisted buffers.', function()
+ itp('should prefer listed buffers to unlisted buffers.', function()
--{ Given: Two buffers that match a pattern
local buf1 = buflist_new(path1, buffer.BLN_LISTED)
local buf2 = buflist_new(path2, buffer.BLN_LISTED)
@@ -265,7 +266,7 @@ describe('buffer functions', function()
local expected_cell_count = option.expected_cell_count or statusline_cell_count
local expected_byte_length = option.expected_byte_length or expected_cell_count
- it(description, function()
+ itp(description, function()
if option.file_name then
buffer.setfname(globals.curbuf, to_cstr(option.file_name), NULL, 1)
else