comparison src/testdir/test_normal.vim @ 15607:2dcaa860e3fc v8.1.0811

patch 8.1.0811: too many #ifdefs commit https://github.com/vim/vim/commit/30276f2beb248557c6b33cd5418bca8b7084b0a5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 17:59:39 2019 +0100 patch 8.1.0811: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, the final chapter.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 18:00:07 +0100
parents 1fd8e32532f7
children 4411c38f3d16
comparison
equal deleted inserted replaced
15606:50e09796a00a 15607:2dcaa860e3fc
1366 let &keywordprg = k 1366 let &keywordprg = k
1367 bw! 1367 bw!
1368 endfunc 1368 endfunc
1369 1369
1370 func Test_normal24_rot13() 1370 func Test_normal24_rot13()
1371 " This test uses multi byte characters
1372 if !has("multi_byte")
1373 return
1374 endif
1375 " Testing for g?? g?g? 1371 " Testing for g?? g?g?
1376 new 1372 new
1377 call append(0, 'abcdefghijklmnopqrstuvwxyzäüö') 1373 call append(0, 'abcdefghijklmnopqrstuvwxyzäüö')
1378 1 1374 1
1379 norm! g?? 1375 norm! g??
1619 set cpo-={ 1615 set cpo-={
1620 bw! 1616 bw!
1621 endfunc 1617 endfunc
1622 1618
1623 fun! Test_normal30_changecase() 1619 fun! Test_normal30_changecase()
1624 " This test uses multi byte characters
1625 if !has("multi_byte")
1626 return
1627 endif
1628 new 1620 new
1629 call append(0, 'This is a simple test: äüöß') 1621 call append(0, 'This is a simple test: äüöß')
1630 norm! 1ggVu 1622 norm! 1ggVu
1631 call assert_equal('this is a simple test: äüöß', getline('.')) 1623 call assert_equal('this is a simple test: äüöß', getline('.'))
1632 norm! VU 1624 norm! VU
1892 set bin noeol 1884 set bin noeol
1893 let a = execute(":norm! \<Esc>gog\<c-g>") 1885 let a = execute(":norm! \<Esc>gog\<c-g>")
1894 call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a) 1886 call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a)
1895 set bin & eol& 1887 set bin & eol&
1896 1888
1897 if has('multi_byte') 1889 call setline(1, ['Français', '日本語'])
1898 call setline(1, ['Français', '日本語']) 1890
1899 1891 let a = execute(":norm! \<Esc>gojlg\<c-g>")
1900 let a = execute(":norm! \<Esc>gojlg\<c-g>") 1892 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a)
1901 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a) 1893
1902 1894 let a = execute(":norm! \<Esc>gojvlg\<c-g>")
1903 let a = execute(":norm! \<Esc>gojvlg\<c-g>") 1895 call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a)
1904 call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a) 1896
1905 1897 let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>")
1906 let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>") 1898 call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a)
1907 call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a) 1899
1908 1900 set fenc=utf8 bomb
1909 set fenc=utf8 bomb 1901 let a = execute(":norm! \<Esc>gojlg\<c-g>")
1910 let a = execute(":norm! \<Esc>gojlg\<c-g>") 1902 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a)
1911 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a) 1903
1912 1904 set fenc=utf16 bomb
1913 set fenc=utf16 bomb 1905 let a = execute(":norm! g\<c-g>")
1914 let a = execute(":norm! g\<c-g>") 1906 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a)
1915 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a) 1907
1916 1908 set fenc=utf32 bomb
1917 set fenc=utf32 bomb 1909 let a = execute(":norm! g\<c-g>")
1918 let a = execute(":norm! g\<c-g>") 1910 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a)
1919 call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a) 1911
1920 1912 set fenc& bomb&
1921 set fenc& bomb&
1922 endif
1923 1913
1924 set ff& 1914 set ff&
1925 bwipe! 1915 bwipe!
1926 endfunc 1916 endfunc
1927 1917
1928 fun! Test_normal34_g_cmd3() 1918 fun! Test_normal34_g_cmd3()
1929 if !has("multi_byte")
1930 return
1931 endif
1932
1933 " Test for g8 1919 " Test for g8
1934 new 1920 new
1935 let a=execute(':norm! 1G0g8') 1921 let a=execute(':norm! 1G0g8')
1936 call assert_equal("\nNUL", a) 1922 call assert_equal("\nNUL", a)
1937 1923
1946 " clean up 1932 " clean up
1947 bw! 1933 bw!
1948 endfunc 1934 endfunc
1949 1935
1950 func Test_normal_8g8() 1936 func Test_normal_8g8()
1951 if !has("multi_byte")
1952 return
1953 endif
1954 new 1937 new
1955 1938
1956 " Test 8g8 which finds invalid utf8 at or after the cursor. 1939 " Test 8g8 which finds invalid utf8 at or after the cursor.
1957 1940
1958 " With invalid byte. 1941 " With invalid byte.
2288 call assert_fails(':let @~="1"', 'E354') 2271 call assert_fails(':let @~="1"', 'E354')
2289 bw! 2272 bw!
2290 endfunc 2273 endfunc
2291 2274
2292 func Test_normal46_ignore() 2275 func Test_normal46_ignore()
2293 " This test uses multi byte characters
2294 if !has("multi_byte")
2295 return
2296 endif
2297
2298 new 2276 new
2299 " How to test this? 2277 " How to test this?
2300 " let's just for now test, that the buffer 2278 " let's just for now test, that the buffer
2301 " does not change 2279 " does not change
2302 call feedkeys("\<c-s>", 't') 2280 call feedkeys("\<c-s>", 't')
2468 call assert_equal(['abcdefghijklmn'], getline(1,'$')) 2446 call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2469 exe "norm! df\<c-\>\<c-g>" 2447 exe "norm! df\<c-\>\<c-g>"
2470 call assert_equal(['abcdefghijklmn'], getline(1,'$')) 2448 call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2471 exe "norm! df\<c-\>m" 2449 exe "norm! df\<c-\>m"
2472 call assert_equal(['abcdefghijklmn'], getline(1,'$')) 2450 call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2473 if !has("multi_byte") 2451
2474 return
2475 endif
2476 call setline(2, 'abcdefghijklmnāf') 2452 call setline(2, 'abcdefghijklmnāf')
2477 norm! 2gg0 2453 norm! 2gg0
2478 exe "norm! df\<Char-0x101>" 2454 exe "norm! df\<Char-0x101>"
2479 call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$')) 2455 call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
2480 norm! 1gg0 2456 norm! 1gg0
2492 normal 6666666666dL 2468 normal 6666666666dL
2493 bwipe! 2469 bwipe!
2494 endfunc 2470 endfunc
2495 2471
2496 func Test_delete_until_paragraph() 2472 func Test_delete_until_paragraph()
2497 if !has('multi_byte')
2498 return
2499 endif
2500 new 2473 new
2501 normal grádv} 2474 normal grádv}
2502 call assert_equal('á', getline(1)) 2475 call assert_equal('á', getline(1))
2503 normal grád} 2476 normal grád}
2504 call assert_equal('', getline(1)) 2477 call assert_equal('', getline(1))