aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-03-05 04:02:45 +0300
committerZyX <kp-pav@yandex.ru>2017-03-11 23:23:30 +0300
commit12b062b2c862fd436cff0df4ebb2e5ca22e75e19 (patch)
tree47cb394b68714d419728e7aca87b9bac909df96f
parent5898b42d82a5a4b594879f30d84611c98ce6bd54 (diff)
downloadrneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.gz
rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.tar.bz2
rneovim-12b062b2c862fd436cff0df4ebb2e5ca22e75e19.zip
unittests: Run all unit tests in their own processes
Used sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua to alter all tests. Locally they all run fine now. Reasoning: 1. General: state from one test should not affect other tests. 2. Local: travis build is failing with something which may be an output of garbage collector. This should prevent state of the garbage collector from interferring as well.
-rw-r--r--test/unit/api/private_helpers_spec.lua9
-rw-r--r--test/unit/buffer_spec.lua25
-rw-r--r--test/unit/eval/decode_spec.lua13
-rw-r--r--test/unit/eval/encode_spec.lua23
-rw-r--r--test/unit/eval/tricks_spec.lua7
-rw-r--r--test/unit/eval/tv_clear_spec.lua9
-rw-r--r--test/unit/fileio_spec.lua31
-rw-r--r--test/unit/garray_spec.lua29
-rw-r--r--test/unit/mbyte_spec.lua13
-rw-r--r--test/unit/memory_spec.lua7
-rw-r--r--test/unit/multiqueue_spec.lua19
-rw-r--r--test/unit/option_spec.lua11
-rw-r--r--test/unit/os/env_spec.lua35
-rw-r--r--test/unit/os/fileio_spec.lua57
-rw-r--r--test/unit/os/fs_spec.lua183
-rw-r--r--test/unit/os/shell_spec.lua25
-rw-r--r--test/unit/os/users_spec.lua17
-rw-r--r--test/unit/path_spec.lua109
-rw-r--r--test/unit/profile_spec.lua37
-rw-r--r--test/unit/rbuffer_spec.lua47
-rw-r--r--test/unit/strings_spec.lua33
-rw-r--r--test/unit/tempfile_spec.lua11
22 files changed, 386 insertions, 364 deletions
diff --git a/test/unit/api/private_helpers_spec.lua b/test/unit/api/private_helpers_spec.lua
index 8c54ea6a2a..eb88f486f6 100644
--- a/test/unit/api/private_helpers_spec.lua
+++ b/test/unit/api/private_helpers_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local eval_helpers = require('test.unit.eval.helpers')
local api_helpers = require('test.unit.api.helpers')
@@ -25,7 +26,7 @@ describe('vim_to_object', function()
end
local different_output_test = function(name, input, output)
- it(name, function()
+ itp(name, function()
eq(output, vim_to_object(input))
end)
end
@@ -76,19 +77,19 @@ describe('vim_to_object', function()
different_output_test('outputs nil for nested lists (2 level, in dict)',
lst3, {{lst=nil_value}, true, false, 'ttest'})
- it('outputs empty list for NULL list', function()
+ itp('outputs empty list for NULL list', function()
local tt = typvalt('VAR_LIST', {v_list=NULL})
eq(nil, tt.vval.v_list)
eq({[type_key]=list_type}, obj2lua(api.vim_to_object(tt)))
end)
- it('outputs empty dict for NULL dict', function()
+ itp('outputs empty dict for NULL dict', function()
local tt = typvalt('VAR_DICT', {v_dict=NULL})
eq(nil, tt.vval.v_dict)
eq({}, obj2lua(api.vim_to_object(tt)))
end)
- it('regression: partials in a list', function()
+ itp('regression: partials in a list', function()
local llist = {
{
[type_key]=func_type,
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua
index 49a4d84279..a4d1be0dd4 100644
--- a/test/unit/buffer_spec.lua
+++ b/test/unit/buffer_spec.lua
@@ -1,5 +1,6 @@
local helpers = require("test.unit.helpers")
+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
diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua
index 742b754d8a..03fe556001 100644
--- a/test/unit/eval/decode_spec.lua
+++ b/test/unit/eval/decode_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local to_cstr = helpers.to_cstr
@@ -29,7 +30,7 @@ describe('json_decode_string()', function()
return ffi.gc(decode.xmemdup(c, 1), decode.xfree)
end
- it('does not overflow when running with `n…`, `t…`, `f…`', function()
+ itp('does not overflow when running with `n…`, `t…`, `f…`', function()
local rettv = ffi.new('typval_T', {v_type=decode.VAR_UNKNOWN})
decode.emsg_silent = 1
-- This will not crash, but if `len` argument will be ignored it will parse
@@ -56,7 +57,7 @@ describe('json_decode_string()', function()
eq(decode.VAR_UNKNOWN, rettv.v_type)
end)
- it('does not overflow and crash when running with `n`, `t`, `f`', function()
+ itp('does not overflow and crash when running with `n`, `t`, `f`', function()
local rettv = ffi.new('typval_T', {v_type=decode.VAR_UNKNOWN})
decode.emsg_silent = 1
eq(0, decode.json_decode_string(char('n'), 1, rettv))
@@ -67,7 +68,7 @@ describe('json_decode_string()', function()
eq(decode.VAR_UNKNOWN, rettv.v_type)
end)
- it('does not overflow when running with `"…`', function()
+ itp('does not overflow when running with `"…`', function()
local rettv = ffi.new('typval_T', {v_type=decode.VAR_UNKNOWN})
decode.emsg_silent = 1
eq(0, decode.json_decode_string('"t"', 2, rettv))
@@ -84,7 +85,7 @@ describe('json_decode_string()', function()
eq(msg, ffi.string(decode.last_msg_hist.msg))
end
- it('does not overflow in error messages', function()
+ itp('does not overflow in error messages', function()
check_failure(']test', 1, 'E474: No container to close: ]')
check_failure('[}test', 2, 'E474: Closing list with curly bracket: }')
check_failure('{]test', 2,
@@ -129,11 +130,11 @@ describe('json_decode_string()', function()
check_failure('[1test', 2, 'E474: Unexpected end of input: [1')
end)
- it('does not overflow with `-`', function()
+ itp('does not overflow with `-`', function()
check_failure('-0', 1, 'E474: Missing number after minus sign: -')
end)
- it('does not overflow and crash when running with `"`', function()
+ itp('does not overflow and crash when running with `"`', function()
local rettv = ffi.new('typval_T', {v_type=decode.VAR_UNKNOWN})
decode.emsg_silent = 1
eq(0, decode.json_decode_string(char('"'), 1, rettv))
diff --git a/test/unit/eval/encode_spec.lua b/test/unit/eval/encode_spec.lua
index 98fc8305e0..1f065e59a1 100644
--- a/test/unit/eval/encode_spec.lua
+++ b/test/unit/eval/encode_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local eval_helpers = require('test.unit.eval.helpers')
local cimport = helpers.cimport
@@ -18,25 +19,25 @@ describe('encode_list_write()', function()
return encode.encode_list_write(l, to_cstr(s), #s)
end
- it('writes empty string', function()
+ itp('writes empty string', function()
local l = list()
eq(0, encode_list_write(l, ''))
eq({[type_key]=list_type}, lst2tbl(l))
end)
- it('writes ASCII string literal with printable characters', function()
+ itp('writes ASCII string literal with printable characters', function()
local l = list()
eq(0, encode_list_write(l, 'abc'))
eq({'abc'}, lst2tbl(l))
end)
- it('writes string starting with NL', function()
+ itp('writes string starting with NL', function()
local l = list()
eq(0, encode_list_write(l, '\nabc'))
eq({null_string, 'abc'}, lst2tbl(l))
end)
- it('writes string starting with NL twice', function()
+ itp('writes string starting with NL twice', function()
local l = list()
eq(0, encode_list_write(l, '\nabc'))
eq({null_string, 'abc'}, lst2tbl(l))
@@ -44,13 +45,13 @@ describe('encode_list_write()', function()
eq({null_string, 'abc', 'abc'}, lst2tbl(l))
end)
- it('writes string ending with NL', function()
+ itp('writes string ending with NL', function()
local l = list()
eq(0, encode_list_write(l, 'abc\n'))
eq({'abc', null_string}, lst2tbl(l))
end)
- it('writes string ending with NL twice', function()
+ itp('writes string ending with NL twice', function()
local l = list()
eq(0, encode_list_write(l, 'abc\n'))
eq({'abc', null_string}, lst2tbl(l))
@@ -58,7 +59,7 @@ describe('encode_list_write()', function()
eq({'abc', 'abc', null_string}, lst2tbl(l))
end)
- it('writes string starting, ending and containing NL twice', function()
+ itp('writes string starting, ending and containing NL twice', function()
local l = list()
eq(0, encode_list_write(l, '\na\nb\n'))
eq({null_string, 'a', 'b', null_string}, lst2tbl(l))
@@ -66,7 +67,7 @@ describe('encode_list_write()', function()
eq({null_string, 'a', 'b', null_string, 'a', 'b', null_string}, lst2tbl(l))
end)
- it('writes string starting, ending and containing NUL with NL between twice', function()
+ itp('writes string starting, ending and containing NUL with NL between twice', function()
local l = list()
eq(0, encode_list_write(l, '\0\n\0\n\0'))
eq({'\n', '\n', '\n'}, lst2tbl(l))
@@ -74,7 +75,7 @@ describe('encode_list_write()', function()
eq({'\n', '\n', '\n\n', '\n', '\n'}, lst2tbl(l))
end)
- it('writes string starting, ending and containing NL with NUL between twice', function()
+ itp('writes string starting, ending and containing NL with NUL between twice', function()
local l = list()
eq(0, encode_list_write(l, '\n\0\n\0\n'))
eq({null_string, '\n', '\n', null_string}, lst2tbl(l))
@@ -82,7 +83,7 @@ describe('encode_list_write()', function()
eq({null_string, '\n', '\n', null_string, '\n', '\n', null_string}, lst2tbl(l))
end)
- it('writes string containing a single NL twice', function()
+ itp('writes string containing a single NL twice', function()
local l = list()
eq(0, encode_list_write(l, '\n'))
eq({null_string, null_string}, lst2tbl(l))
@@ -90,7 +91,7 @@ describe('encode_list_write()', function()
eq({null_string, null_string, null_string}, lst2tbl(l))
end)
- it('writes string containing a few NLs twice', function()
+ itp('writes string containing a few NLs twice', function()
local l = list()
eq(0, encode_list_write(l, '\n\n\n'))
eq({null_string, null_string, null_string, null_string}, lst2tbl(l))
diff --git a/test/unit/eval/tricks_spec.lua b/test/unit/eval/tricks_spec.lua
index 4c5184995c..ff63dc5cde 100644
--- a/test/unit/eval/tricks_spec.lua
+++ b/test/unit/eval/tricks_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local to_cstr = helpers.to_cstr
@@ -15,7 +16,7 @@ local eval_expr = function(expr)
end
describe('NULL typval_T', function()
- it('is produced by $XXX_UNEXISTENT_VAR_XXX', function()
+ itp('is produced by $XXX_UNEXISTENT_VAR_XXX', function()
-- Required for various tests which need to check whether typval_T with NULL
-- string works correctly. This test checks that unexistent environment
-- variable produces NULL string, not that some specific environment
@@ -29,13 +30,13 @@ describe('NULL typval_T', function()
eq(nil, rettv.vval.v_string)
end)
- it('is produced by v:_null_list', function()
+ itp('is produced by v:_null_list', function()
local rettv = eval_expr('v:_null_list')
eq(eval.VAR_LIST, rettv.v_type)
eq(nil, rettv.vval.v_list)
end)
- it('is produced by v:_null_dict', function()
+ itp('is produced by v:_null_dict', function()
local rettv = eval_expr('v:_null_dict')
eq(eval.VAR_DICT, rettv.v_type)
eq(nil, rettv.vval.v_dict)
diff --git a/test/unit/eval/tv_clear_spec.lua b/test/unit/eval/tv_clear_spec.lua
index 96eccdbd71..7601192f47 100644
--- a/test/unit/eval/tv_clear_spec.lua
+++ b/test/unit/eval/tv_clear_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.unit.helpers')
+local itp = helpers.gen_itp(it)
local eval_helpers = require('test.unit.eval.helpers')
local alloc_log_new = helpers.alloc_log_new
@@ -26,7 +27,7 @@ after_each(function()
end)
describe('clear_tv()', function()
- it('successfully frees all lists in [&l [1], *l, *l]', function()
+ itp('successfully frees all lists in [&l [1], *l, *l]', function()
local l_inner = {1}
local list = {l_inner, l_inner, l_inner}
local list_tv = ffi.gc(lua2typvalt(list), nil)
@@ -53,7 +54,7 @@ describe('clear_tv()', function()
a.freed(list_p),
})
end)
- it('successfully frees all lists in [&l [], *l, *l]', function()
+ itp('successfully frees all lists in [&l [], *l, *l]', function()
local l_inner = {[type_key]=list_type}
local list = {l_inner, l_inner, l_inner}
local list_tv = ffi.gc(lua2typvalt(list), nil)
@@ -77,7 +78,7 @@ describe('clear_tv()', function()
a.freed(list_p),
})
end)
- it('successfully frees all dictionaries in [&d {}, *d]', function()
+ itp('successfully frees all dictionaries in [&d {}, *d]', function()
local d_inner = {}
local list = {d_inner, d_inner}
local list_tv = ffi.gc(lua2typvalt(list), nil)
@@ -99,7 +100,7 @@ describe('clear_tv()', function()
a.freed(list_p),
})
end)
- it('successfully frees all dictionaries in [&d {a: 1}, *d]', function()
+ itp('successfully frees all dictionaries in [&d {a: 1}, *d]', function()
local d_inner = {a=1}
local list = {d_inner, d_inner}
local list_tv = ffi.gc(lua2typvalt(list), nil)
diff --git a/test/unit/fileio_spec.lua b/test/unit/fileio_spec.lua
index 3e3c36617d..13ff5d1f11 100644
--- a/test/unit/fileio_spec.lua
+++ b/test/unit/fileio_spec.lua
@@ -1,4 +1,5 @@
local helpers = require("test.unit.helpers")
+local itp = helpers.gen_itp(it)
--{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.helpers'
local eq = helpers.eq
@@ -16,67 +17,67 @@ describe('file_pat functions', function()
return ffi.string(res)
end
- it('returns ^path$ regex for literal path input', function()
+ itp('returns ^path$ regex for literal path input', function()
eq( '^path$', file_pat_to_reg_pat('path'))
end)
- it('does not prepend ^ when there is a starting glob (*)', function()
+ itp('does not prepend ^ when there is a starting glob (*)', function()
eq('path$', file_pat_to_reg_pat('*path'))
end)
- it('does not append $ when there is an ending glob (*)', function()
+ itp('does not append $ when there is an ending glob (*)', function()
eq('^path', file_pat_to_reg_pat('path*'))
end)
- it('does not include ^ or $ when surrounded by globs (*)', function()
+ itp('does not include ^ or $ when surrounded by globs (*)', function()
eq('path', file_pat_to_reg_pat('*path*'))
end)
- it('replaces the bash any character (?) with the regex any character (.)', function()
+ itp('replaces the bash any character (?) with the regex any character (.)', function()
eq('^foo.bar$', file_pat_to_reg_pat('foo?bar'))
end)
- it('replaces a glob (*) in the middle of a path with regex multiple any character (.*)',
+ itp('replaces a glob (*) in the middle of a path with regex multiple any character (.*)',
function()
eq('^foo.*bar$', file_pat_to_reg_pat('foo*bar'))
end)
- it([[unescapes \? to ?]], function()
+ itp([[unescapes \? to ?]], function()
eq('^foo?bar$', file_pat_to_reg_pat([[foo\?bar]]))
end)
- it([[unescapes \% to %]], function()
+ itp([[unescapes \% to %]], function()
eq('^foo%bar$', file_pat_to_reg_pat([[foo\%bar]]))
end)
- it([[unescapes \, to ,]], function()
+ itp([[unescapes \, to ,]], function()
eq('^foo,bar$', file_pat_to_reg_pat([[foo\,bar]]))
end)
- it([[unescapes '\ ' to ' ']], function()
+ itp([[unescapes '\ ' to ' ']], function()
eq('^foo bar$', file_pat_to_reg_pat([[foo\ bar]]))
end)
- it([[escapes . to \.]], function()
+ itp([[escapes . to \.]], function()
eq([[^foo\.bar$]], file_pat_to_reg_pat('foo.bar'))
end)
- it('Converts bash brace expansion {a,b} to regex options (a|b)', function()
+ itp('Converts bash brace expansion {a,b} to regex options (a|b)', function()
eq([[^foo\(bar\|baz\)$]], file_pat_to_reg_pat('foo{bar,baz}'))
end)
- it('Collapses multiple consecutive * into a single character', function()
+ itp('Collapses multiple consecutive * into a single character', function()
eq([[^foo.*bar$]], file_pat_to_reg_pat('foo*******bar'))
eq([[foobar$]], file_pat_to_reg_pat('********foobar'))
eq([[^foobar]], file_pat_to_reg_pat('foobar********'))
end)
- it('Does not escape ^', function()
+ itp('Does not escape ^', function()
eq([[^^blah$]], file_pat_to_reg_pat('^blah'))
eq([[^foo^bar$]], file_pat_to_reg_pat('foo^bar'))
end)
- it('Does not escape $', function()
+ itp('Does not escape $', function()
eq([[^blah$$]], file_pat_to_reg_pat('blah$'))
eq([[^foo$bar$]], file_pat_to_reg_pat('foo$bar'))
end)
diff --git a/test/unit/garray_spec.lua b/test/unit/garray_spec.lua
index 422ef7b36a..e55c514353 100644
--- a/test/unit/garray_spec.lua
+++ b/test/unit/garray_spec.lua
@@ -1,4 +1,5 @@
local helpers = require("test.unit.helpers")
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local internalize = helpers.internalize
@@ -183,7 +184,7 @@ end
describe('garray', function()
describe('ga_init', function()
- it('initializes the values of the garray', function()
+ itp('initializes the values of the garray', function()
local garr = new_garray()
ga_init(garr, itemsize, growsize)
eq(0, ga_len(garr))
@@ -204,7 +205,7 @@ describe('garray', function()
return garr
end
- it('grows by growsize items if num < growsize', function()
+ itp('grows by growsize items if num < growsize', function()
itemsize = 16
growsize = 4
local grow_by = growsize - 1
@@ -213,7 +214,7 @@ describe('garray', function()
eq(growsize, ga_maxlen(garr)) -- we requested LESS than growsize, so...
end)
- it('grows by num items if num > growsize', function()
+ itp('grows by num items if num > growsize', function()
itemsize = 16
growsize = 4
local grow_by = growsize + 1
@@ -222,7 +223,7 @@ describe('garray', function()
eq(grow_by, ga_maxlen(garr)) -- we requested MORE than growsize, so...
end)
- it('does not grow when nothing is requested', function()
+ itp('does not grow when nothing is requested', function()
local garr = new_and_grow(16, 4, 0)
eq(NULL, ga_data(garr))
eq(0, ga_maxlen(garr))
@@ -230,7 +231,7 @@ describe('garray', function()
end)
describe('ga_clear', function()
- it('clears an already allocated array', function()
+ itp('clears an already allocated array', function()
-- allocate and scramble an array
local garr = garray_ctype()
ga_init(garr, itemsize, growsize)
@@ -247,7 +248,7 @@ describe('garray', function()
end)
describe('ga_append', function()
- it('can append bytes', function()
+ itp('can append bytes', function()
-- this is the actual ga_append, the others are just emulated lua
-- versions
local garr = new_garray()
@@ -262,7 +263,7 @@ describe('garray', function()
eq('hello', ffi.string(bytes))
end)
- it('can append integers', function()
+ itp('can append integers', function()
local garr = new_garray()
ga_init(garr, ffi.sizeof("int"), 1)
local input = {
@@ -279,7 +280,7 @@ describe('garray', function()
end
end)
- it('can append strings to a growing array of strings', function()
+ itp('can append strings to a growing array of strings', function()
local garr = new_string_garray()
local input = {
"some",
@@ -298,7 +299,7 @@ describe('garray', function()
end)
describe('ga_concat', function()
- it('concatenates the parameter to the growing byte array', function()
+ itp('concatenates the parameter to the growing byte array', function()
local garr = new_garray()
ga_init(garr, ffi.sizeof("char"), 1)
local str = "ohwell●●"
@@ -329,11 +330,11 @@ describe('garray', function()
end
describe('ga_concat_strings', function()
- it('returns an empty string when concatenating an empty array', function()
+ itp('returns an empty string when concatenating an empty array', function()
test_concat_fn({ }, ga_concat_strings)
end)
- it('can concatenate a non-empty array', function()
+ itp('can concatenate a non-empty array', function()
test_concat_fn({
'oh',
'my',
@@ -343,11 +344,11 @@ describe('garray', function()
end)
describe('ga_concat_strings_sep', function()
- it('returns an empty string when concatenating an empty array', function()
+ itp('returns an empty string when concatenating an empty array', function()
test_concat_fn({ }, ga_concat_strings_sep, '---')
end)
- it('can concatenate a non-empty array', function()
+ itp('can concatenate a non-empty array', function()
local sep = '-●●-'
test_concat_fn({
'oh',
@@ -358,7 +359,7 @@ describe('garray', function()
end)
describe('ga_remove_duplicate_strings', function()
- it('sorts and removes duplicate strings', function()
+ itp('sorts and removes duplicate strings', function()
local garr = new_string_garray()
local input = {
'ccc',
diff --git a/test/unit/mbyte_spec.lua b/test/unit/mbyte_spec.lua
index 9b2415a93f..a772a5d5e5 100644
--- a/test/unit/mbyte_spec.lua
+++ b/test/unit/mbyte_spec.lua
@@ -1,4 +1,5 @@
local helpers = require("test.unit.helpers")
+local itp = helpers.gen_itp(it)
local ffi = helpers.ffi
local eq = helpers.eq
@@ -26,7 +27,7 @@ describe('mbyte', function()
before_each(function()
end)
- it('utf_ptr2char', function()
+ itp('utf_ptr2char', function()
-- For strings with length 1 the first byte is returned.
for c = 0, 255 do
eq(c, mbyte.utf_ptr2char(to_string({c, 0})))
@@ -44,7 +45,7 @@ describe('mbyte', function()
describe('utfc_ptr2char_len', function()
- it('1-byte sequences', function()
+ itp('1-byte sequences', function()
local pcc = to_intp()
for c = 0, 255 do
eq(c, mbyte.utfc_ptr2char_len(to_string({c}), pcc, 1))
@@ -52,7 +53,7 @@ describe('mbyte', function()
end
end)
- it('2-byte sequences', function()
+ itp('2-byte sequences', function()
local pcc = to_intp()
-- No combining characters
eq(0x007f, mbyte.utfc_ptr2char_len(to_string({0x7f, 0x7f}), pcc, 2))
@@ -76,7 +77,7 @@ describe('mbyte', function()
eq(0, pcc[0])
end)
- it('3-byte sequences', function()
+ itp('3-byte sequences', function()
local pcc = to_intp()
-- No second UTF-8 character
@@ -108,7 +109,7 @@ describe('mbyte', function()
eq(0, pcc[0])
end)
- it('4-byte sequences', function()
+ itp('4-byte sequences', function()
local pcc = to_intp()
-- No following combining character
@@ -145,7 +146,7 @@ describe('mbyte', function()
eq(0, pcc[0])
end)
- it('5+-byte sequences', function()
+ itp('5+-byte sequences', function()
local pcc = to_intp()
-- No following combining character
diff --git a/test/unit/memory_spec.lua b/test/unit/memory_spec.lua
index 73a32724ef..744ff3cf19 100644
--- a/test/unit/memory_spec.lua
+++ b/test/unit/memory_spec.lua
@@ -1,4 +1,5 @@
local helpers = require("test.unit.helpers")
+local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
local cstr = helpers.cstr
@@ -26,7 +27,7 @@ describe('xstrlcat()', function()
return ffi.string(dst_cstr)
end
- it('concatenates strings', function()
+ itp('concatenates strings', function()
eq('ab', test_xstrlcat('a', 'b', 3))
eq('ab', test_xstrlcat('a', 'b', 4096))
eq('ABCיהZdefgiיהZ', test_xstrlcat('ABCיהZ', 'defgiיהZ', 4096))
@@ -34,7 +35,7 @@ describe('xstrlcat()', function()
eq('a', test_xstrlcat('a', '', 4096))
end)
- it('concatenates overlapping strings', function()
+ itp('concatenates overlapping strings', function()
eq('abcabc', test_xstrlcat_overlap('abc', 0, 7))
eq('abca', test_xstrlcat_overlap('abc', 0, 5))
eq('abcb', test_xstrlcat_overlap('abc', 1, 5))
@@ -42,7 +43,7 @@ describe('xstrlcat()', function()
eq('abcabc', test_xstrlcat_overlap('abc', 0, 2343))
end)
- it('truncates if `dsize` is too small', function()
+ itp('truncates if `dsize` is too small', function()
eq('a', test_xstrlcat('a', 'b', 2))
eq('', test_xstrlcat('', 'b', 1))
eq('ABCיהZd', test_xstrlcat('ABCיהZ', 'defgiיהZ', 10))
diff --git a/test/unit/multiqueue_spec.lua b/test/unit/multiqueue_spec.lua
index c7f8dd8328..632a091d60 100644
--- a/test/unit/multiqueue_spec.lua
+++ b/test/unit/multiqueue_spec.lua
@@ -1,4 +1,5 @@
local helpers = require("test.unit.helpers")
+local itp = helpers.gen_itp(it)
local ffi = helpers.ffi
local eq = helpers.eq
@@ -36,13 +37,13 @@ describe("multiqueue (multi-level event-queue)", function()
put(child3, 'c3i2')
end)
- it('keeps count of added events', function()
+ itp('keeps count of added events', function()
eq(3, multiqueue.multiqueue_size(child1))
eq(4, multiqueue.multiqueue_size(child2))
eq(2, multiqueue.multiqueue_size(child3))
end)
- it('keeps count of removed events', function()
+ itp('keeps count of removed events', function()
multiqueue.multiqueue_get(child1)
eq(2, multiqueue.multiqueue_size(child1))
multiqueue.multiqueue_get(child1)
@@ -57,7 +58,7 @@ describe("multiqueue (multi-level event-queue)", function()
eq(0, multiqueue.multiqueue_size(child1))
end)
- it('removing from parent removes from child', function()
+ itp('removing from parent removes from child', function()
eq('c1i1', get(parent))
eq('c1i2', get(parent))
eq('c2i1', get(parent))
@@ -67,7 +68,7 @@ describe("multiqueue (multi-level event-queue)", function()
eq('c2i4', get(parent))
end)
- it('removing from child removes from parent', function()
+ itp('removing from child removes from parent', function()
eq('c2i1', get(child2))
eq('c2i2', get(child2))
eq('c1i1', get(child1))
@@ -77,13 +78,13 @@ describe("multiqueue (multi-level event-queue)", function()
eq('c2i4', get(parent))
end)
- it('removing from child at the beginning of parent', function()
+ itp('removing from child at the beginning of parent', function()
eq('c1i1', get(child1))
eq('c1i2', get(child1))
eq('c2i1', get(parent))
end)
- it('removing from parent after get from parent and put to child', function()
+ itp('removing from parent after get from parent and put to child', function()
eq('c1i1', get(parent))
eq('c1i2', get(parent))
eq('c2i1', get(parent))
@@ -99,7 +100,7 @@ describe("multiqueue (multi-level event-queue)", function()
eq('c1i22', get(parent))
end)
- it('removing from parent after get and put to child', function()
+ itp('removing from parent after get and put to child', function()
eq('c1i1', get(child1))