patch 8.2.0886: cannot use octal numbers in scriptversion 4
Problem: Cannot use octal numbers in scriptversion 4.
Solution: Add the "0o" notation. (Ken Takata, closes #5304)
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 325f8e2..33c57fd 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -199,9 +199,12 @@
func Test_vvar_scriptversion4()
call assert_true(has('vimscript-4'))
call assert_equal(17, 017)
+ call assert_equal(15, 0o17)
+ call assert_equal(15, 0O17)
call assert_equal(18, 018)
call assert_equal(64, 0b1'00'00'00)
call assert_equal(1048576, 0x10'00'00)
+ call assert_equal(32768, 0o10'00'00)
call assert_equal(1000000, 1'000'000)
call assert_equal("1234", execute("echo 1'234")->trim())
call assert_equal('1 234', execute("echo 1''234")->trim())
@@ -211,6 +214,8 @@
scriptversion 1
func Test_vvar_scriptversion1()
call assert_equal(15, 017)
+ call assert_equal(15, 0o17)
+ call assert_equal(15, 0O17)
call assert_equal(18, 018)
endfunc
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 2253879..a82c70b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -189,6 +189,10 @@
call assert_equal(65, str2nr('0101', 8))
call assert_equal(-65, str2nr('-101', 8))
call assert_equal(-65, str2nr('-0101', 8))
+ call assert_equal(65, str2nr('0o101', 8))
+ call assert_equal(65, str2nr('0O0101', 8))
+ call assert_equal(-65, str2nr('-0O101', 8))
+ call assert_equal(-65, str2nr('-0o0101', 8))
call assert_equal(11259375, str2nr('abcdef', 16))
call assert_equal(11259375, str2nr('ABCDEF', 16))
@@ -207,6 +211,7 @@
call assert_equal(0, str2nr('0x10'))
call assert_equal(0, str2nr('0b10'))
+ call assert_equal(0, str2nr('0o10'))
call assert_equal(1, str2nr('12', 2))
call assert_equal(1, str2nr('18', 8))
call assert_equal(1, str2nr('1g', 16))