Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 21391:8b882afa8ed2 v8.2.1246
patch 8.2.1246: Vim9: comment after assignment doesn't work
Commit: https://github.com/vim/vim/commit/b209750b5e907003568c20856215122670ee22d2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 19 17:17:02 2020 +0200
patch 8.2.1246: Vim9: comment after assignment doesn't work
Problem: Vim9: comment after assignment doesn't work.
Solution: Skip over white space. (closes https://github.com/vim/vim/issues/6481)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Jul 2020 17:30:03 +0200 |
parents | 92e2ed2a2778 |
children | 8992d4f63761 |
comparison
equal
deleted
inserted
replaced
21390:00c6c02dc0b8 | 21391:8b882afa8ed2 |
---|---|
27 | 27 |
28 call CheckDefFailure(['let x:string'], 'E1069:') | 28 call CheckDefFailure(['let x:string'], 'E1069:') |
29 call CheckDefFailure(['let x:string = "x"'], 'E1069:') | 29 call CheckDefFailure(['let x:string = "x"'], 'E1069:') |
30 call CheckDefFailure(['let a:string = "x"'], 'E1069:') | 30 call CheckDefFailure(['let a:string = "x"'], 'E1069:') |
31 | 31 |
32 let a: number = 6 | 32 let a: number = 6 #comment |
33 assert_equal(6, a) | 33 assert_equal(6, a) |
34 | 34 |
35 if has('channel') | 35 if has('channel') |
36 let chan1: channel | 36 let chan1: channel |
37 let job1: job | 37 let job1: job |
42 endif | 42 endif |
43 let Funky1: func | 43 let Funky1: func |
44 let Funky2: func = function('len') | 44 let Funky2: func = function('len') |
45 let Party2: func = funcref('g:Test_syntax') | 45 let Party2: func = funcref('g:Test_syntax') |
46 | 46 |
47 g:newvar = 'new' | 47 g:newvar = 'new' #comment |
48 assert_equal('new', g:newvar) | 48 assert_equal('new', g:newvar) |
49 | 49 |
50 assert_equal('yes', g:existing) | 50 assert_equal('yes', g:existing) |
51 g:existing = 'no' | 51 g:existing = 'no' |
52 assert_equal('no', g:existing) | 52 assert_equal('no', g:existing) |
819 END | 819 END |
820 CheckScriptSuccess(lines) | 820 CheckScriptSuccess(lines) |
821 set errorformat& | 821 set errorformat& |
822 enddef | 822 enddef |
823 | 823 |
824 def Test_list_vimscript() | |
825 # checks line continuation and comments | |
826 let lines =<< trim END | |
827 vim9script | |
828 let mylist = [ | |
829 'one', | |
830 # comment | |
831 'two', # empty line follows | |
832 | |
833 'three', | |
834 ] | |
835 assert_equal(['one', 'two', 'three'], mylist) | |
836 END | |
837 CheckScriptSuccess(lines) | |
838 enddef | |
839 | |
824 if has('channel') | 840 if has('channel') |
825 let someJob = test_null_job() | 841 let someJob = test_null_job() |
826 | 842 |
827 def FuncWithError() | 843 def FuncWithError() |
828 echomsg g:someJob | 844 echomsg g:someJob |