Mercurial > vim
comparison src/testdir/test_increment.vim @ 19969:b07672d13ff9 v8.2.0540
patch 8.2.0540: regexp and other code not tested
Commit: https://github.com/vim/vim/commit/004a6781b3cf15ca5dd632c38cc09bb3b253d1f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 11 17:09:31 2020 +0200
patch 8.2.0540: regexp and other code not tested
Problem: Regexp and other code not tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5904)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Apr 2020 17:15:06 +0200 |
parents | f70a3c1000bb |
children | 9edb439adbea |
comparison
equal
deleted
inserted
replaced
19968:1908e92b02fd | 19969:b07672d13ff9 |
---|---|
473 set nrformats+=alpha | 473 set nrformats+=alpha |
474 call setline(1, ["a"]) | 474 call setline(1, ["a"]) |
475 exec "norm! \<C-A>" | 475 exec "norm! \<C-A>" |
476 call assert_equal(["b"], getline(1, '$')) | 476 call assert_equal(["b"], getline(1, '$')) |
477 call assert_equal([0, 1, 1, 0], getpos('.')) | 477 call assert_equal([0, 1, 1, 0], getpos('.')) |
478 " decrement a and A and increment z and Z | |
479 call setline(1, ['a', 'A', 'z', 'Z']) | |
480 exe "normal 1G\<C-X>2G\<C-X>3G\<C-A>4G\<C-A>" | |
481 call assert_equal(['a', 'A', 'z', 'Z'], getline(1, '$')) | |
478 endfunc | 482 endfunc |
479 | 483 |
480 " 21) block-wise increment on part of hexadecimal | 484 " 21) block-wise increment on part of hexadecimal |
481 " Text: | 485 " Text: |
482 " 0x123456 | 486 " 0x123456 |
563 " | 567 " |
564 " Expected: | 568 " Expected: |
565 " 1) <ctrl-a> | 569 " 1) <ctrl-a> |
566 " 0b11111111111111111111111111111111 | 570 " 0b11111111111111111111111111111111 |
567 func Test_visual_increment_26() | 571 func Test_visual_increment_26() |
568 set nrformats+=alpha | 572 set nrformats+=bin |
569 call setline(1, ["0b11111111111111111111111111111110"]) | 573 call setline(1, ["0b11111111111111111111111111111110"]) |
570 exec "norm! \<C-V>$\<C-A>" | 574 exec "norm! \<C-V>$\<C-A>" |
571 call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) | 575 call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) |
572 call assert_equal([0, 1, 1, 0], getpos('.')) | 576 call assert_equal([0, 1, 1, 0], getpos('.')) |
573 set nrformats-=alpha | 577 exec "norm! \<C-V>$\<C-X>" |
578 call assert_equal(["0b11111111111111111111111111111110"], getline(1, '$')) | |
579 set nrformats-=bin | |
574 endfunc | 580 endfunc |
575 | 581 |
576 " 27) increment with 'rightreft', if supported | 582 " 27) increment with 'rightreft', if supported |
577 func Test_visual_increment_27() | 583 func Test_visual_increment_27() |
578 if exists('+rightleft') | 584 if exists('+rightleft') |
769 \ "-100 -100x100 000 "], getline(1, '$')) | 775 \ "-100 -100x100 000 "], getline(1, '$')) |
770 call assert_equal([0, 3, 25, 0], getpos('.')) | 776 call assert_equal([0, 3, 25, 0], getpos('.')) |
771 endfunc | 777 endfunc |
772 | 778 |
773 func Test_increment_empty_line() | 779 func Test_increment_empty_line() |
774 new | |
775 call setline(1, ['0', '0', '0', '0', '0', '0', '']) | 780 call setline(1, ['0', '0', '0', '0', '0', '0', '']) |
776 exe "normal Gvgg\<C-A>" | 781 exe "normal Gvgg\<C-A>" |
777 call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7)) | 782 call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7)) |
778 | 783 |
779 " Ctrl-A/Ctrl-X should do nothing in operator pending mode | 784 " Ctrl-A/Ctrl-X should do nothing in operator pending mode |
780 %d | 785 %d |
781 call setline(1, 'one two') | 786 call setline(1, 'one two') |
782 exe "normal! c\<C-A>l" | 787 exe "normal! c\<C-A>l" |
783 exe "normal! c\<C-X>l" | 788 exe "normal! c\<C-X>l" |
784 call assert_equal('one two', getline(1)) | 789 call assert_equal('one two', getline(1)) |
785 | 790 endfunc |
786 bwipe! | 791 |
792 " Try incrementing/decrementing a non-digit/alpha character | |
793 func Test_increment_special_char() | |
794 call setline(1, '!') | |
795 call assert_beeps("normal \<C-A>") | |
796 call assert_beeps("normal \<C-X>") | |
787 endfunc | 797 endfunc |
788 | 798 |
789 " vim: shiftwidth=2 sts=2 expandtab | 799 " vim: shiftwidth=2 sts=2 expandtab |