diff options
author | James McCoy <jamessan@jamessan.com> | 2016-07-08 14:09:10 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-07-23 20:42:46 -0400 |
commit | 452707e0b0bb6927350d2a68485a5453c214610b (patch) | |
tree | 8828900cc312e1e6bd2b1f53e4ed92dc30edd79f /test/functional/legacy/assert_spec.lua | |
parent | f1d912c584c10f92fe0710e3a907c3d519fbe7d8 (diff) | |
download | rneovim-452707e0b0bb6927350d2a68485a5453c214610b.tar.gz rneovim-452707e0b0bb6927350d2a68485a5453c214610b.tar.bz2 rneovim-452707e0b0bb6927350d2a68485a5453c214610b.zip |
vim-patch:7.4.1703
Problem: Can't assert for not equal and not matching.
Solution: Add assert_notmatch() and assert_notequal().
https://github.com/vim/vim/commit/b50e5f56861deb867478997397f7c784a7043233
Diffstat (limited to 'test/functional/legacy/assert_spec.lua')
-rw-r--r-- | test/functional/legacy/assert_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua index cf1dcf6686..42dd25023a 100644 --- a/test/functional/legacy/assert_spec.lua +++ b/test/functional/legacy/assert_spec.lua @@ -64,6 +64,20 @@ describe('assert function:', function() end) end) + -- assert_notequal({expected}, {actual}[, {msg}]) + describe('assert_notequal', function() + it('should not change v:errors when expected differs from actual', function() + call('assert_notequal', 'foo', 4) + call('assert_notequal', {1, 2, 3}, 'foo') + expected_empty() + end) + + it('should change v:errors when expected is equal to actual', function() + call('assert_notequal', 'foo', 'foo') + expected_errors({"Expected 'foo' differs from 'foo'"}) + end) + end) + -- assert_false({actual}, [, {msg}]) describe('assert_false', function() it('should not change v:errors when actual is false', function() @@ -173,6 +187,20 @@ describe('assert function:', function() end) end) + -- assert_notmatch({pat}, {text}[, {msg}]) + describe('assert_notmatch', function() + it('should not change v:errors when pat does not match text', function() + call('assert_notmatch', 'foo', 'bar') + call('assert_notmatch', '^foobar$', 'foobars') + expected_empty() + end) + + it('should change v:errors when pat matches text', function() + call('assert_notmatch', 'foo', 'foobar') + expected_errors({"Pattern 'foo' does match 'foobar'"}) + end) + end) + -- assert_fails({cmd}, [, {error}]) describe('assert_fails', function() it('should change v:errors when error does not match v:errmsg', function() |