1
0
forked from aniani/vim

patch 8.2.4871: Vim9: in :def function no error for misplaced range

Problem:    Vim9: in :def function no error for using a range with a command
            that does not accept one.
Solution:   Check for the command to accept a range. (closes #10330)
This commit is contained in:
Bram Moolenaar
2022-05-05 15:20:03 +01:00
parent f3b4895f27
commit 09d9421b67
3 changed files with 30 additions and 0 deletions

View File

@@ -67,6 +67,29 @@ def Test_range_only()
endif
enddef
def Test_invalid_range()
var lines =<< trim END
:123 eval 1 + 2
END
v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
lines =<< trim END
:123 if true
endif
END
v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
lines =<< trim END
:123 echo 'yes'
END
v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
lines =<< trim END
:123 cd there
END
v9.CheckDefAndScriptFailure(lines, 'E481:', 1)
enddef
let g:alist = [7]
let g:astring = 'text'
let g:anumber = 123