0
0
mirror of https://github.com/vim/vim.git synced 2025-10-20 08:14:18 -04:00

patch 8.1.2035: recognizing octal numbers is confusing

Problem:    Recognizing octal numbers is confusing.
Solution:   Introduce scriptversion 4: do not use octal and allow for single
            quote inside numbers.
This commit is contained in:
Bram Moolenaar
2019-09-15 14:33:22 +02:00
parent 50bf7ce0c9
commit 60a8de28d1
8 changed files with 78 additions and 27 deletions

View File

@@ -74,7 +74,7 @@ func Test_readfile_binary()
new
call setline(1, ['one', 'two', 'three'])
setlocal ff=dos
write XReadfile
silent write XReadfile
let lines = 'XReadfile'->readfile()
call assert_equal(['one', 'two', 'three'], lines)
let lines = readfile('XReadfile', '', 2)
@@ -124,6 +124,15 @@ func Test_string_concatenation()
call assert_equal('ab', a)
endfunc
" Test fix for issue #4507
func Test_skip_after_throw()
try
throw 'something'
let x = wincol() || &ts
catch /something/
endtry
endfunc
scriptversion 2
func Test_string_concat_scriptversion2()
call assert_true(has('vimscript-2'))
@@ -183,17 +192,23 @@ func Test_dict_access_scriptversion2()
call assert_true(1 && l:x.foo)
endfunc
func Test_scriptversion()
scriptversion 4
func Test_vvar_scriptversion4()
call assert_equal(17, 017)
call assert_equal(18, 018)
call assert_equal(64, 0b1'00'00'00)
call assert_equal(1048576, 0x10'00'00)
call assert_equal(1000000, 1'000'000)
endfunc
scriptversion 1
func Test_vvar_scriptversion1()
call assert_equal(15, 017)
call assert_equal(18, 018)
endfunc
func Test_scriptversion_fail()
call writefile(['scriptversion 9'], 'Xversionscript')
call assert_fails('source Xversionscript', 'E999:')
call delete('Xversionscript')
endfunc
" Test fix for issue #4507
func Test_skip_after_throw()
try
throw 'something'
let x = wincol() || &ts
catch /something/
endtry
endfunc