diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-05 04:02:45 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:23:30 +0300 |
commit | 12b062b2c862fd436cff0df4ebb2e5ca22e75e19 (patch) | |
tree | 47cb394b68714d419728e7aca87b9bac909df96f /test/unit/rbuffer_spec.lua | |
parent | 5898b42d82a5a4b594879f30d84611c98ce6bd54 (diff) | |
download | rneovim-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.
Diffstat (limited to 'test/unit/rbuffer_spec.lua')
-rw-r--r-- | test/unit/rbuffer_spec.lua | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/test/unit/rbuffer_spec.lua b/test/unit/rbuffer_spec.lua index 89136410d3..ef838fb7c7 100644 --- a/test/unit/rbuffer_spec.lua +++ b/test/unit/rbuffer_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 @@ -50,7 +51,7 @@ describe('rbuffer functions', function() end) describe('with empty buffer in one contiguous chunk', function() - it('is called once with the empty chunk', function() + itp('is called once with the empty chunk', function() collect_write_chunks() eq({'0000000000000000'}, chunks) end) @@ -61,7 +62,7 @@ describe('rbuffer functions', function() write('string') end) - it('is called once with the empty chunk', function() + itp('is called once with the empty chunk', function() collect_write_chunks() eq({'0000000000'}, chunks) end) @@ -72,7 +73,7 @@ describe('rbuffer functions', function() write('abcdefghijklmnopq') end) - it('is not called', function() + itp('is not called', function() collect_write_chunks() eq({}, chunks) end) @@ -84,7 +85,7 @@ describe('rbuffer functions', function() read(8) end) - it('is called twice with each filled chunk', function() + itp('is called twice with each filled chunk', function() collect_write_chunks() eq({'000000', '12345678'}, chunks) end) @@ -96,7 +97,7 @@ describe('rbuffer functions', function() read(8) end) - it('is called twice with each filled chunk', function() + itp('is called twice with each filled chunk', function() collect_write_chunks() eq({'00000000', '12345678'}, chunks) end) @@ -109,7 +110,7 @@ describe('rbuffer functions', function() write('abcdefghijklmnopq') end) - it('is not called', function() + itp('is not called', function() collect_write_chunks() eq({}, chunks) end) @@ -130,7 +131,7 @@ describe('rbuffer functions', function() end) describe('with empty buffer', function() - it('is not called', function() + itp('is not called', function() collect_read_chunks() eq({}, chunks) end) @@ -141,7 +142,7 @@ describe('rbuffer functions', function() write('string') end) - it('is called once with the filled chunk', function() + itp('is called once with the filled chunk', function() collect_read_chunks() eq({'string'}, chunks) end) @@ -152,7 +153,7 @@ describe('rbuffer functions', function() write('abcdefghijklmnopq') end) - it('is called once with the filled chunk', function() + itp('is called once with the filled chunk', function() collect_read_chunks() eq({'abcdefghijklmnop'}, chunks) end) @@ -165,7 +166,7 @@ describe('rbuffer functions', function() write('long string') end) - it('is called twice with each filled chunk', function() + itp('is called twice with each filled chunk', function() collect_read_chunks() eq({'long s', 'tring'}, chunks) end) @@ -178,7 +179,7 @@ describe('rbuffer functions', function() write('abcdefghijklmnopq') end) - it('is called twice with each filled chunk', function() + itp('is called twice with each filled chunk', function() collect_read_chunks() eq({'abcdefgh', 'ijklmnop'}, chunks) end) @@ -198,7 +199,7 @@ describe('rbuffer functions', function() end) describe('with empty buffer', function() - it('is not called', function() + itp('is not called', function() collect_chars() eq({}, chars) end) @@ -211,7 +212,7 @@ describe('rbuffer functions', function() write('long string') end) - it('collects each character and index', function() + itp('collects each character and index', function() collect_chars() eq({{'l', 0}, {'o', 1}, {'n', 2}, {'g', 3}, {' ', 4}, {'s', 5}, {'t', 6}, {'r', 7}, {'i', 8}, {'n', 9}, {'g', 10}}, chars) @@ -232,7 +233,7 @@ describe('rbuffer functions', function() end) describe('with empty buffer', function() - it('is not called', function() + itp('is not called', function() collect_chars() eq({}, chars) end) @@ -245,7 +246,7 @@ describe('rbuffer functions', function() write('long string') end) - it('collects each character and index', function() + itp('collects each character and index', function() collect_chars() eq({{'g', 10}, {'n', 9}, {'i', 8}, {'r', 7}, {'t', 6}, {'s', 5}, {' ', 4}, {'g', 3}, {'n', 2}, {'o', 1}, {'l', 0}}, chars) @@ -270,7 +271,7 @@ describe('rbuffer functions', function() write('long string') end) - it('compares the common longest sequence', function() + itp('compares the common longest sequence', function() eq(0, cmp('long string')) eq(0, cmp('long strin')) eq(-1, cmp('long striM')) @@ -282,31 +283,31 @@ describe('rbuffer functions', function() end) describe('with empty buffer', function() - it('returns 0 since no characters are compared', function() + itp('returns 0 since no characters are compared', function() eq(0, cmp('')) end) end) end) describe('rbuffer_write', function() - it('fills the internal buffer and returns the write count', function() + itp('fills the internal buffer and returns the write count', function() eq(12, write('short string')) eq('short string0000', inspect()) end) - it('wont write beyond capacity', function() + itp('wont write beyond capacity', function() eq(16, write('very very long string')) eq('very very long s', inspect()) end) end) describe('rbuffer_read', function() - it('reads what was previously written', function() + itp('reads what was previously written', function() write('to read') eq('to read', read(20)) end) - it('reads nothing if the buffer is empty', function() + itp('reads nothing if the buffer is empty', function() eq('', read(20)) write('empty') eq('empty', read(20)) @@ -315,7 +316,7 @@ describe('rbuffer functions', function() end) describe('rbuffer_get', function() - it('fetch the pointer at offset, wrapping if required', function() + itp('fetch the pointer at offset, wrapping if required', function() write('1234567890') read(10) write('long string') @@ -334,7 +335,7 @@ describe('rbuffer functions', function() end) describe('wrapping behavior', function() - it('writing/reading wraps across the end of the internal buffer', function() + itp('writing/reading wraps across the end of the internal buffer', function() write('1234567890') eq('1234', read(4)) eq('5678', read(4)) |