Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 19872:8a7bede7b138 v8.2.0492
patch 8.2.0492: Vim9: some error messages not tested
Commit: https://github.com/vim/vim/commit/a8c1770469504ae66c80bbdb03b6b31641215848
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 1 21:17:24 2020 +0200
patch 8.2.0492: Vim9: some error messages not tested
Problem: Vim9: some error messages not tested.
Solution: Add more tests. Remove dead code. Fix uncovered bugs.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 01 Apr 2020 21:30:03 +0200 |
parents | 846fbbacce3a |
children | f92435f0f449 |
comparison
equal
deleted
inserted
replaced
19871:7f8a267721e4 | 19872:8a7bede7b138 |
---|---|
29 endfunc | 29 endfunc |
30 | 30 |
31 let s:appendToMe = 'xxx' | 31 let s:appendToMe = 'xxx' |
32 let s:addToMe = 111 | 32 let s:addToMe = 111 |
33 let g:existing = 'yes' | 33 let g:existing = 'yes' |
34 let g:inc_counter = 1 | |
35 let $SOME_ENV_VAR = 'some' | |
34 | 36 |
35 def Test_assignment() | 37 def Test_assignment() |
36 let bool1: bool = true | 38 let bool1: bool = true |
37 assert_equal(v:true, bool1) | 39 assert_equal(v:true, bool1) |
38 let bool2: bool = false | 40 let bool2: bool = false |
92 assert_equal('xxxyyy', s:appendToMe) | 94 assert_equal('xxxyyy', s:appendToMe) |
93 s:addToMe += 222 | 95 s:addToMe += 222 |
94 assert_equal(333, s:addToMe) | 96 assert_equal(333, s:addToMe) |
95 s:newVar = 'new' | 97 s:newVar = 'new' |
96 assert_equal('new', s:newVar) | 98 assert_equal('new', s:newVar) |
99 | |
100 set ts=7 | |
101 &ts += 1 | |
102 assert_equal(8, &ts) | |
103 call CheckDefFailure(['¬ex += 3'], 'E113:') | |
104 call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:') | |
105 call CheckDefFailure(['&path += 3'], 'E1013:') | |
106 | |
107 g:inc_counter += 1 | |
108 assert_equal(2, g:inc_counter) | |
109 | |
110 $SOME_ENV_VAR ..= 'more' | |
111 assert_equal('somemore', $SOME_ENV_VAR) | |
112 call CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1013:') | |
113 call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1013:') | |
114 | |
115 @a = 'areg' | |
116 @a ..= 'add' | |
117 assert_equal('aregadd', @a) | |
118 call CheckDefFailure(['@a += "more"'], 'E1013:') | |
119 call CheckDefFailure(['@a += 123'], 'E1013:') | |
97 enddef | 120 enddef |
98 | 121 |
99 func Test_assignment_failure() | 122 func Test_assignment_failure() |
100 call CheckDefFailure(['let var=234'], 'E1004:') | 123 call CheckDefFailure(['let var=234'], 'E1004:') |
101 call CheckDefFailure(['let var =234'], 'E1004:') | 124 call CheckDefFailure(['let var =234'], 'E1004:') |