aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/assert_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-07-24 12:29:06 -0500
committerGitHub <noreply@github.com>2016-07-24 12:29:06 -0500
commit2bb4c43f2faf043f828cf98c1354ab3a2b380fa4 (patch)
tree42fa44be81203efd7bf6d2e0639cd492f2a6f3b6 /test/functional/legacy/assert_spec.lua
parent8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6 (diff)
parenta4987bac3ea8cf6d1e7a9677e5cbdf52d618dced (diff)
downloadrneovim-2bb4c43f2faf043f828cf98c1354ab3a2b380fa4.tar.gz
rneovim-2bb4c43f2faf043f828cf98c1354ab3a2b380fa4.tar.bz2
rneovim-2bb4c43f2faf043f828cf98c1354ab3a2b380fa4.zip
Merge pull request #5020 from jamessan/vim-7.4.1663
vim-patch:7.4.1663,7.4.1682,7.4.1703
Diffstat (limited to 'test/functional/legacy/assert_spec.lua')
-rw-r--r--test/functional/legacy/assert_spec.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 8da6ee45d7..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()
@@ -155,10 +169,43 @@ describe('assert function:', function()
end)
end)
+ -- assert_match({pat}, {text}[, {msg}])
+ describe('assert_match', function()
+ it('should not change v:errors when pat matches text', function()
+ call('assert_match', '^f.*b.*r$', 'foobar')
+ expected_empty()
+ end)
+
+ it('should change v:errors when pat does not match text', function()
+ call('assert_match', 'bar.*foo', 'foobar')
+ expected_errors({"Pattern 'bar.*foo' does not match 'foobar'"})
+ end)
+
+ it('should set v:errors to msg when given and match fails', function()
+ call('assert_match', 'bar.*foo', 'foobar', 'wrong')
+ expected_errors({"'wrong'"})
+ 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()
execute([[call assert_fails('xxx', {})]])
+ execute([[call assert_match("Expected {} but got 'E731:", v:errors[0])]])
expected_errors({"Expected {} but got 'E731: using Dictionary as a String'"})
end)