|
| 1 | +" Test ga normal command, and :ascii Ex command. |
| 2 | +func Do_ga(c) |
| 3 | + call setline(1, a:c) |
| 4 | + let l:a = execute("norm 1goga") |
| 5 | + let l:b = execute("ascii") |
| 6 | + call assert_equal(l:a, l:b) |
| 7 | + return l:a |
| 8 | +endfunc |
| 9 | + |
| 10 | +func Test_ga_command() |
| 11 | + new |
| 12 | + set display=uhex |
| 13 | + call assert_equal("\nNUL", Do_ga('')) |
| 14 | + call assert_equal("\n<<01>> 1, Hex 01, Octal 001", Do_ga("\x01")) |
| 15 | + call assert_equal("\n<<09>> 9, Hex 09, Octal 011", Do_ga("\t")) |
| 16 | + |
| 17 | + set display= |
| 18 | + call assert_equal("\nNUL", Do_ga('')) |
| 19 | + call assert_equal("\n<^A> 1, Hex 01, Octal 001", Do_ga("\x01")) |
| 20 | + call assert_equal("\n<^I> 9, Hex 09, Octal 011", Do_ga("\t")) |
| 21 | + |
| 22 | + call assert_equal("\n<e> 101, Hex 65, Octal 145", Do_ga('e')) |
| 23 | + |
| 24 | + if !has('multi_byte') |
| 25 | + return |
| 26 | + endif |
| 27 | + |
| 28 | + " Test a few multi-bytes characters. |
| 29 | + call assert_equal("\n<é> 233, Hex 00e9, Octal 351", Do_ga('é')) |
| 30 | + call assert_equal("\n<ẻ> 7867, Hex 1ebb, Octal 17273", Do_ga('ẻ')) |
| 31 | + |
| 32 | + " Test with combining characters. |
| 33 | + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301")) |
| 34 | + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331")) |
| 35 | + call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461 < ̸> 824, Hex 0338, Octal 1470", Do_ga("e\u0301\u0331\u0338")) |
| 36 | + bwipe! |
| 37 | +endfunc |
0 commit comments