From 6617629ad6eceeb77d49633780a7213eeb17a2c9 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sat, 22 May 2021 19:44:53 +0100 Subject: vim-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. https://github.com/vim/vim/commit/60a8de28d11595f4df0419ece8afa7d6accc9fbd :scriptversion is N/A. Cherry-pick Test_readfile_binary() from v8.1.0742. Note that this patch was missing vim_str2nr() changes, and so fails the tests; this was fixed in v8.1.2036. --- src/nvim/testdir/test_functions.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 6cb3e24201..a78e617572 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -161,6 +161,12 @@ func Test_str2nr() call assert_equal(11259375, str2nr('0XABCDEF', 16)) call assert_equal(-11259375, str2nr('-0xABCDEF', 16)) + call assert_equal(1, str2nr("1'000'000", 10, 0)) + call assert_equal(256, str2nr("1'0000'0000", 2, 1)) + call assert_equal(262144, str2nr("1'000'000", 8, 1)) + call assert_equal(1000000, str2nr("1'000'000", 10, 1)) + call assert_equal(65536, str2nr("1'00'00", 16, 1)) + call assert_equal(0, str2nr('0x10')) call assert_equal(0, str2nr('0b10')) call assert_equal(1, str2nr('12', 2)) -- cgit