diff options
author | Jason Schulz <jason@schulz.name> | 2015-12-29 15:17:16 -0800 |
---|---|---|
committer | Jason Schulz <jason@schulz.name> | 2016-01-15 18:21:06 -0800 |
commit | 7ad3f077dc68a83b2cdfb7b1d04de9266d7978a9 (patch) | |
tree | aaa485d0853be6b46865cf2d87064ec0299f0cde /test/functional/legacy | |
parent | dddbf9c5fa061cb03d6b6240ac6610b68b9304f5 (diff) | |
download | rneovim-7ad3f077dc68a83b2cdfb7b1d04de9266d7978a9.tar.gz rneovim-7ad3f077dc68a83b2cdfb7b1d04de9266d7978a9.tar.bz2 rneovim-7ad3f077dc68a83b2cdfb7b1d04de9266d7978a9.zip |
Add support for binary numbers
Diffstat (limited to 'test/functional/legacy')
-rw-r--r-- | test/functional/legacy/035_increment_and_decrement_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/legacy/057_sort_spec.lua | 35 |
2 files changed, 51 insertions, 10 deletions
diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua index 20c0cc4206..e6252c384b 100644 --- a/test/functional/legacy/035_increment_and_decrement_spec.lua +++ b/test/functional/legacy/035_increment_and_decrement_spec.lua @@ -11,34 +11,40 @@ describe('increment and decrement commands', function() it('should work', function() -- Insert some numbers in various bases. insert([[ - 100 0x100 077 0 - 100 0x100 077 + 0b101 100 0x100 077 0 + 0b101 100 0x100 077 100 0x100 077 0xfF 0xFf - 100 0x100 077]]) + 100 0x100 077 + 0x0b101 0b1101]]) -- Increment and decrement numbers in the first row, interpreting the -- numbers as decimal, octal or hexadecimal. - execute('set nrformats=octal,hex', '1') - feed('102ll64128$') + execute('set nrformats=bin,octal,hex', '1') + feed('63l102ll64128$') -- 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') + feed('0w102l2w65129blx6lD') -- 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. + -- For the fourth row, interpret all numbers as decimal. execute('set nrformats=', '4') feed('0200l100w78') + -- For the last row, interpret as binary and hexadecimal. + execute('set nrformats=bin,hex', '5') + feed('010065l6432') + expect([[ - 0 0x0ff 0000 -1 - 0 1x100 0777777 + 0b011 0 0x0ff 0000 -1 + 1b101 0 1x100 0777777 -1 0x0 078 0xFE 0xfe - -100 -100x100 000]]) + -100 -100x100 000 + 0x0b0de 0b0101101]]) end) end) diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua index 585b391198..65defbae96 100644 --- a/test/functional/legacy/057_sort_spec.lua +++ b/test/functional/legacy/057_sort_spec.lua @@ -600,4 +600,39 @@ describe(':sort', function() eq('Vim(sort):E474: Invalid argument', eval('tmpvar')) expect(text) end) + + it('binary', function() + insert([[ + 0b111000 + 0b101100 + 0b101001 + 0b101001 + 0b101000 + 0b000000 + 0b001000 + 0b010000 + 0b101000 + 0b100000 + 0b101010 + 0b100010 + 0b100100 + 0b100010]]) + execute([[sort b]]) + expect([[ + 0b000000 + 0b001000 + 0b010000 + 0b100000 + 0b100010 + 0b100010 + 0b100100 + 0b101000 + 0b101000 + 0b101001 + 0b101001 + 0b101010 + 0b101100 + 0b111000]]) + end) + end) |