comparison src/testdir/test_arabic.vim @ 11221:3fa27b97d263 v8.0.0497

patch 8.0.0497: arabic support is not fully tested commit https://github.com/vim/vim/commit/3ff2f09525e3461419886763efa1a01f08882d8c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 21 13:22:44 2017 +0100 patch 8.0.0497: arabic support is not fully tested Problem: Arabic support is not fully tested. Solution: Add more tests for the untested functions. Comment out unreachable code.
author Christian Brabandt <cb@256bit.org>
date Tue, 21 Mar 2017 13:30:05 +0100
parents f91d4c95b696
children 81c348d40312
comparison
equal deleted inserted replaced
11220:09300a732ca2 11221:3fa27b97d263
1 " Simplistic testing of Arabic mode. 1 " Simplistic testing of Arabic mode.
2 " NOTE: This just checks if the code works. If you know Arabic please add
3 " functional tests that check the shaping works with real text.
2 4
3 if !has('arabic') || !has('multi_byte') 5 if !has('arabic') || !has('multi_byte')
4 finish 6 finish
5 endif 7 endif
6 8
415 417
416 set arabicshape& 418 set arabicshape&
417 bwipe! 419 bwipe!
418 endfunc 420 endfunc
419 421
420 func Test_shape_medial() 422 func Test_shape_iso_to_medial()
421 new 423 new
422 set arabicshape 424 set arabicshape
423 425
424 " Shaping arabic {testchar} arabic Tests chg_c_a2m(). 426 " Shaping arabic {testchar} arabic Tests chg_c_a2m().
425 " pair[0] = testchar, pair[1] = next-result, pair[2] = current-result, 427 " pair[0] = testchar, pair[1] = next-result, pair[2] = current-result,
468 470
469 set arabicshape& 471 set arabicshape&
470 bwipe! 472 bwipe!
471 endfunc 473 endfunc
472 474
475 func Test_shape_final()
476 new
477 set arabicshape
478
479 " Shaping arabic {testchar} arabic Tests chg_c_a2f().
480 " pair[0] = testchar, pair[1] = current-result, pair[2] = previous-result
481 for pair in [[s:a_HAMZA, s:a_s_HAMZA, s:a_s_BEH],
482 \[s:a_ALEF_MADDA, s:a_f_ALEF_MADDA, s:a_i_BEH],
483 \[s:a_ALEF_HAMZA_ABOVE, s:a_f_ALEF_HAMZA_ABOVE, s:a_i_BEH],
484 \[s:a_WAW_HAMZA, s:a_f_WAW_HAMZA, s:a_i_BEH],
485 \[s:a_ALEF_HAMZA_BELOW, s:a_f_ALEF_HAMZA_BELOW, s:a_i_BEH],
486 \[s:a_YEH_HAMZA, s:a_f_YEH_HAMZA, s:a_i_BEH],
487 \[s:a_ALEF, s:a_f_ALEF, s:a_i_BEH],
488 \[s:a_BEH, s:a_f_BEH, s:a_i_BEH],
489 \[s:a_TEH_MARBUTA, s:a_f_TEH_MARBUTA, s:a_i_BEH],
490 \[s:a_TEH, s:a_f_TEH, s:a_i_BEH],
491 \[s:a_THEH, s:a_f_THEH, s:a_i_BEH],
492 \[s:a_JEEM, s:a_f_JEEM, s:a_i_BEH],
493 \[s:a_HAH, s:a_f_HAH, s:a_i_BEH],
494 \[s:a_KHAH, s:a_f_KHAH, s:a_i_BEH],
495 \[s:a_DAL, s:a_f_DAL, s:a_i_BEH],
496 \[s:a_THAL, s:a_f_THAL, s:a_i_BEH],
497 \[s:a_REH, s:a_f_REH, s:a_i_BEH],
498 \[s:a_ZAIN, s:a_f_ZAIN, s:a_i_BEH],
499 \[s:a_SEEN, s:a_f_SEEN, s:a_i_BEH],
500 \[s:a_SHEEN, s:a_f_SHEEN, s:a_i_BEH],
501 \[s:a_SAD, s:a_f_SAD, s:a_i_BEH],
502 \[s:a_DAD, s:a_f_DAD, s:a_i_BEH],
503 \[s:a_TAH, s:a_f_TAH, s:a_i_BEH],
504 \[s:a_ZAH, s:a_f_ZAH, s:a_i_BEH],
505 \[s:a_AIN, s:a_f_AIN, s:a_i_BEH],
506 \[s:a_GHAIN, s:a_f_GHAIN, s:a_i_BEH],
507 \[s:a_TATWEEL, s:a_TATWEEL, s:a_i_BEH],
508 \[s:a_FEH, s:a_f_FEH, s:a_i_BEH],
509 \[s:a_QAF, s:a_f_QAF, s:a_i_BEH],
510 \[s:a_KAF, s:a_f_KAF, s:a_i_BEH],
511 \[s:a_LAM, s:a_f_LAM, s:a_i_BEH],
512 \[s:a_MEEM, s:a_f_MEEM, s:a_i_BEH],
513 \[s:a_NOON, s:a_f_NOON, s:a_i_BEH],
514 \[s:a_HEH, s:a_f_HEH, s:a_i_BEH],
515 \[s:a_WAW, s:a_f_WAW, s:a_i_BEH],
516 \[s:a_ALEF_MAKSURA, s:a_f_ALEF_MAKSURA, s:a_i_BEH],
517 \[s:a_YEH, s:a_f_YEH, s:a_i_BEH],
518 \ ]
519 call setline(1, ' ' . pair[0] . s:a_BEH)
520 call assert_equal([' ' . pair[1] . pair[2]], ScreenLines(1, 3))
521 endfor
522
523 set arabicshape&
524 bwipe!
525 endfunc
526
527 func Test_shape_final_to_medial()
528 new
529 set arabicshape
530
531 " Shaping arabic {testchar} arabic Tests chg_c_f2m().
532 " This does not test much...
533 " pair[0] = testchar, pair[1] = current-result
534 for pair in [[s:a_f_YEH_HAMZA, s:a_f_BEH],
535 \[s:a_f_WAW_HAMZA, s:a_s_BEH],
536 \[s:a_f_ALEF, s:a_s_BEH],
537 \[s:a_f_TEH_MARBUTA, s:a_s_BEH],
538 \[s:a_f_DAL, s:a_s_BEH],
539 \[s:a_f_THAL, s:a_s_BEH],
540 \[s:a_f_REH, s:a_s_BEH],
541 \[s:a_f_ZAIN, s:a_s_BEH],
542 \[s:a_f_WAW, s:a_s_BEH],
543 \[s:a_f_ALEF_MAKSURA, s:a_s_BEH],
544 \[s:a_f_BEH, s:a_f_BEH],
545 \[s:a_f_TEH, s:a_f_BEH],
546 \[s:a_f_THEH, s:a_f_BEH],
547 \[s:a_f_JEEM, s:a_f_BEH],
548 \[s:a_f_HAH, s:a_f_BEH],
549 \[s:a_f_KHAH, s:a_f_BEH],
550 \[s:a_f_SEEN, s:a_f_BEH],
551 \[s:a_f_SHEEN, s:a_f_BEH],
552 \[s:a_f_SAD, s:a_f_BEH],
553 \[s:a_f_DAD, s:a_f_BEH],
554 \[s:a_f_TAH, s:a_f_BEH],
555 \[s:a_f_ZAH, s:a_f_BEH],
556 \[s:a_f_AIN, s:a_f_BEH],
557 \[s:a_f_GHAIN, s:a_f_BEH],
558 \[s:a_f_FEH, s:a_f_BEH],
559 \[s:a_f_QAF, s:a_f_BEH],
560 \[s:a_f_KAF, s:a_f_BEH],
561 \[s:a_f_LAM, s:a_f_BEH],
562 \[s:a_f_MEEM, s:a_f_BEH],
563 \[s:a_f_NOON, s:a_f_BEH],
564 \[s:a_f_HEH, s:a_f_BEH],
565 \[s:a_f_YEH, s:a_f_BEH],
566 \ ]
567 call setline(1, ' ' . s:a_BEH . pair[0])
568 call assert_equal([' ' . pair[1] . pair[0]], ScreenLines(1, 3))
569 endfor
570
571 set arabicshape&
572 bwipe!
573 endfunc
574
575 func Test_shape_combination_final()
576 new
577 set arabicshape
578
579 " Shaping arabic {testchar} arabic Tests chg_c_laa2f().
580 " pair[0] = testchar, pair[1] = current-result
581 for pair in [[s:a_ALEF_MADDA, s:a_f_LAM_ALEF_MADDA_ABOVE],
582 \ [s:a_ALEF_HAMZA_ABOVE, s:a_f_LAM_ALEF_HAMZA_ABOVE],
583 \ [s:a_ALEF_HAMZA_BELOW, s:a_f_LAM_ALEF_HAMZA_BELOW],
584 \ [s:a_ALEF, s:a_f_LAM_ALEF],
585 \ ]
586 " The test char is a composing char, put on s:a_LAM.
587 call setline(1, ' ' . s:a_LAM . pair[0] . s:a_BEH)
588 call assert_equal([' ' . pair[1] . s:a_i_BEH], ScreenLines(1, 3))
589 endfor
590
591 set arabicshape&
592 bwipe!
593 endfunc
594
595 func Test_shape_combination_isolated()
596 new
597 set arabicshape
598
599 " Shaping arabic {testchar} arabic Tests chg_c_laa2i().
600 " pair[0] = testchar, pair[1] = current-result
601 for pair in [[s:a_ALEF_MADDA, s:a_s_LAM_ALEF_MADDA_ABOVE],
602 \ [s:a_ALEF_HAMZA_ABOVE, s:a_s_LAM_ALEF_HAMZA_ABOVE],
603 \ [s:a_ALEF_HAMZA_BELOW, s:a_s_LAM_ALEF_HAMZA_BELOW],
604 \ [s:a_ALEF, s:a_s_LAM_ALEF],
605 \ ]
606 " The test char is a composing char, put on s:a_LAM.
607 call setline(1, ' ' . s:a_LAM . pair[0] . ' ')
608 call assert_equal([' ' . pair[1] . ' '], ScreenLines(1, 3))
609 endfor
610
611 set arabicshape&
612 bwipe!
613 endfunc