diff options
-rw-r--r-- | src/nvim/testdir/test35.in | 21 | ||||
-rw-r--r-- | src/nvim/testdir/test35.ok | 4 | ||||
-rw-r--r-- | test/functional/legacy/035_increment_and_decrement_spec.lua | 44 |
3 files changed, 44 insertions, 25 deletions
diff --git a/src/nvim/testdir/test35.in b/src/nvim/testdir/test35.in deleted file mode 100644 index ba97911a1d..0000000000 --- a/src/nvim/testdir/test35.in +++ /dev/null @@ -1,21 +0,0 @@ -Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal, -and octal numbers. - -STARTTEST -/^start-here -:set nrformats=octal,hex -j102ll64128$ -:set nrformats=octal -0102l2w65129blx6lD -:set nrformats=hex -0101l257Txldt -:set nrformats= -0200l100w78k -:$-3,$wq! test.out -ENDTEST - -start-here -100 0x100 077 0 -100 0x100 077 -100 0x100 077 0xfF 0xFf -100 0x100 077 diff --git a/src/nvim/testdir/test35.ok b/src/nvim/testdir/test35.ok deleted file mode 100644 index 093ad958ac..0000000000 --- a/src/nvim/testdir/test35.ok +++ /dev/null @@ -1,4 +0,0 @@ -0 0x0ff 0000 -1 -0 1x100 0777777 --1 0x0 078 0xFE 0xfe --100 -100x100 000 diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua new file mode 100644 index 0000000000..20c0cc4206 --- /dev/null +++ b/test/functional/legacy/035_increment_and_decrement_spec.lua @@ -0,0 +1,44 @@ +-- Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal, +-- and octal numbers. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('increment and decrement commands', function() + setup(clear) + + it('should work', function() + -- Insert some numbers in various bases. + insert([[ + 100 0x100 077 0 + 100 0x100 077 + 100 0x100 077 0xfF 0xFf + 100 0x100 077]]) + + -- Increment and decrement numbers in the first row, interpreting the + -- numbers as decimal, octal or hexadecimal. + execute('set nrformats=octal,hex', '1') + feed('102ll64128$') + + -- For the second row, treat the numbers as decimal or octal. + -- 0x100 should be interpreted as decimal 0, the character x, and decimal 100. + execute('set nrformats=octal', '2') + feed('0102l2w65129blx6lD') + + -- For the third row, treat the numbers as decimal or hexadecimal. + -- 077 should be interpreted as decimal 77. + execute('set nrformats=hex', '3') + feed('0101l257Txldt ') + + -- For the last row, interpret all numbers as decimal. + execute('set nrformats=', '4') + feed('0200l100w78') + + expect([[ + 0 0x0ff 0000 -1 + 0 1x100 0777777 + -1 0x0 078 0xFE 0xfe + -100 -100x100 000]]) + end) +end) |