diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-04-04 18:15:38 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-04-04 18:15:38 +0200 |
commit | 558ca4ae55096f8763ab8515a304cda9c57f18a7 (patch) | |
tree | 3eeff81990411749a97a0684dde7b8ba5e28acdf /src/testdir/test_eval_stuff.vim | |
parent | 8f4aeb5572d604d1540ee0cb7e721b5f0cc6d612 (diff) | |
download | vim-git-558ca4ae55096f8763ab8515a304cda9c57f18a7.tar.gz |
patch 8.1.1116: cannot enforce a Vim script stylev8.1.1116
Problem: Cannot enforce a Vim script style.
Solution: Add the :scriptversion command. (closes #3857)
Diffstat (limited to 'src/testdir/test_eval_stuff.vim')
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 6d61ce924..d6aeb6f93 100644 --- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -123,3 +123,39 @@ func Test_string_concatenation() let a..=b call assert_equal('ab', a) endfunc + +scriptversion 2 +func Test_string_concat_scriptversion2() + let a = 'a' + let b = 'b' + + call assert_fails('echo a . b', 'E15:') + call assert_fails('let a .= b', 'E985:') + call assert_fails('let vers = 1.2.3', 'E15:') + + if has('float') + let f = .5 + call assert_equal(0.5, f) + endif +endfunc + +scriptversion 1 +func Test_string_concat_scriptversion1() + let a = 'a' + let b = 'b' + + echo a . b + let a .= b + let vers = 1.2.3 + call assert_equal('123', vers) + + if has('float') + call assert_fails('let f = .5', 'E15:') + endif +endfunc + +func Test_scriptversion() + call writefile(['scriptversion 9'], 'Xversionscript') + call assert_fails('source Xversionscript', 'E999:') + call delete('Xversionscript') +endfunc |