Mercurial > vim
comparison src/testdir/test_digraph.vim @ 25378:890fd8211202 v8.2.3226
patch 8.2.3226: new digraph functions use old naming scheme
Commit: https://github.com/vim/vim/commit/29b857150c111a455f1a38a8f748243524f692e1
Author: h-east <h.east.727@gmail.com>
Date: Mon Jul 26 21:54:04 2021 +0200
patch 8.2.3226: new digraph functions use old naming scheme
Problem: New digraph functions use old naming scheme.
Solution: Use the digraph_ prefix. (Hirohito Higashi, closes https://github.com/vim/vim/issues/8580)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 26 Jul 2021 22:00:07 +0200 |
parents | c626fd34b66f |
children | 6b711b01f2ca |
comparison
equal
deleted
inserted
replaced
25377:5197d46bc088 | 25378:890fd8211202 |
---|---|
513 call TermWait(buf) | 513 call TermWait(buf) |
514 call assert_equal('½', term_getline(buf, 1)) | 514 call assert_equal('½', term_getline(buf, 1)) |
515 call StopVimInTerminal(buf) | 515 call StopVimInTerminal(buf) |
516 endfunc | 516 endfunc |
517 | 517 |
518 func Test_setdigraph_function() | 518 func Test_digraph_set_function() |
519 new | 519 new |
520 call setdigraph('aa', 'あ') | 520 call digraph_set('aa', 'あ') |
521 call Put_Dig('aa') | 521 call Put_Dig('aa') |
522 call assert_equal('あ', getline('$')) | 522 call assert_equal('あ', getline('$')) |
523 call setdigraph(' i', 'い') | 523 call digraph_set(' i', 'い') |
524 call Put_Dig(' i') | 524 call Put_Dig(' i') |
525 call assert_equal('い', getline('$')) | 525 call assert_equal('い', getline('$')) |
526 call setdigraph(' ', 'う') | 526 call digraph_set(' ', 'う') |
527 call Put_Dig(' ') | 527 call Put_Dig(' ') |
528 call assert_equal('う', getline('$')) | 528 call assert_equal('う', getline('$')) |
529 | 529 |
530 eval 'aa'->setdigraph('え') | 530 eval 'aa'->digraph_set('え') |
531 call Put_Dig('aa') | 531 call Put_Dig('aa') |
532 call assert_equal('え', getline('$')) | 532 call assert_equal('え', getline('$')) |
533 | 533 |
534 call assert_fails('call setdigraph("aaa", "あ")', 'E1214: Digraph must be just two characters: aaa') | 534 call assert_fails('call digraph_set("aaa", "あ")', 'E1214: Digraph must be just two characters: aaa') |
535 call assert_fails('call setdigraph("b", "あ")', 'E1214: Digraph must be just two characters: b') | 535 call assert_fails('call digraph_set("b", "あ")', 'E1214: Digraph must be just two characters: b') |
536 call assert_fails('call setdigraph("あ", "あ")', 'E1214: Digraph must be just two characters: あ') | 536 call assert_fails('call digraph_set("あ", "あ")', 'E1214: Digraph must be just two characters: あ') |
537 call assert_fails('call setdigraph("aa", "ああ")', 'E1215: Digraph must be one character: ああ') | 537 call assert_fails('call digraph_set("aa", "ああ")', 'E1215: Digraph must be one character: ああ') |
538 call assert_fails('call setdigraph("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099)) | 538 call assert_fails('call digraph_set("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099)) |
539 bwipe! | 539 bwipe! |
540 endfunc | 540 endfunc |
541 | 541 |
542 func Test_getdigraph_function() | 542 func Test_digraph_get_function() |
543 " Built-in digraphs | 543 " Built-in digraphs |
544 call assert_equal('∞', getdigraph('00')) | 544 call assert_equal('∞', digraph_get('00')) |
545 | 545 |
546 " User-defined digraphs | 546 " User-defined digraphs |
547 call setdigraph('aa', 'あ') | 547 call digraph_set('aa', 'あ') |
548 call setdigraph(' i', 'い') | 548 call digraph_set(' i', 'い') |
549 call setdigraph(' ', 'う') | 549 call digraph_set(' ', 'う') |
550 call assert_equal('あ', getdigraph('aa')) | 550 call assert_equal('あ', digraph_get('aa')) |
551 call assert_equal('あ', 'aa'->getdigraph()) | 551 call assert_equal('あ', 'aa'->digraph_get()) |
552 call assert_equal('い', getdigraph(' i')) | 552 call assert_equal('い', digraph_get(' i')) |
553 call assert_equal('う', getdigraph(' ')) | 553 call assert_equal('う', digraph_get(' ')) |
554 call assert_fails('call getdigraph("aaa")', 'E1214: Digraph must be just two characters: aaa') | 554 call assert_fails('call digraph_get("aaa")', 'E1214: Digraph must be just two characters: aaa') |
555 call assert_fails('call getdigraph("b")', 'E1214: Digraph must be just two characters: b') | 555 call assert_fails('call digraph_get("b")', 'E1214: Digraph must be just two characters: b') |
556 endfunc | 556 endfunc |
557 | 557 |
558 func Test_getdigraph_function_encode() | 558 func Test_digraph_get_function_encode() |
559 CheckFeature iconv | 559 CheckFeature iconv |
560 let testcases = { | 560 let testcases = { |
561 \'00': '∞', | 561 \'00': '∞', |
562 \'aa': 'あ', | 562 \'aa': 'あ', |
563 \} | 563 \} |
564 for [key, ch] in items(testcases) | 564 for [key, ch] in items(testcases) |
565 call setdigraph(key, ch) | 565 call digraph_set(key, ch) |
566 set encoding=japan | 566 set encoding=japan |
567 call assert_equal(iconv(ch, 'utf-8', 'japan'), getdigraph(key)) | 567 call assert_equal(iconv(ch, 'utf-8', 'japan'), digraph_get(key)) |
568 set encoding& | 568 set encoding& |
569 endfor | 569 endfor |
570 endfunc | 570 endfunc |
571 | 571 |
572 func Test_setdigraphlist_function() | 572 func Test_digraph_setlist_function() |
573 call setdigraphlist([['aa', 'き'], ['bb', 'く']]) | 573 call digraph_setlist([['aa', 'き'], ['bb', 'く']]) |
574 call assert_equal('き', getdigraph('aa')) | 574 call assert_equal('き', digraph_get('aa')) |
575 call assert_equal('く', getdigraph('bb')) | 575 call assert_equal('く', digraph_get('bb')) |
576 | 576 |
577 call assert_fails('call setdigraphlist([[]])', 'E1216:') | 577 call assert_fails('call digraph_setlist([[]])', 'E1216:') |
578 call assert_fails('call setdigraphlist([["aa", "b", "cc"]])', '1216:') | 578 call assert_fails('call digraph_setlist([["aa", "b", "cc"]])', '1216:') |
579 call assert_fails('call setdigraphlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ') | 579 call assert_fails('call digraph_setlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ') |
580 endfunc | 580 endfunc |
581 | 581 |
582 func Test_getdigraphlist_function() | 582 func Test_digraph_getlist_function() |
583 " Make sure user-defined digraphs are defined | 583 " Make sure user-defined digraphs are defined |
584 call setdigraphlist([['aa', 'き'], ['bb', 'く']]) | 584 call digraph_setlist([['aa', 'き'], ['bb', 'く']]) |
585 | 585 |
586 for pair in getdigraphlist(1) | 586 for pair in digraph_getlist(1) |
587 call assert_equal(getdigraph(pair[0]), pair[1]) | 587 call assert_equal(digraph_get(pair[0]), pair[1]) |
588 endfor | 588 endfor |
589 | 589 |
590 " We don't know how many digraphs are registered before, so check the number | 590 " We don't know how many digraphs are registered before, so check the number |
591 " of digraphs returned. | 591 " of digraphs returned. |
592 call assert_equal(getdigraphlist()->len(), getdigraphlist(0)->len()) | 592 call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len()) |
593 call assert_notequal((getdigraphlist()->len()), getdigraphlist(1)->len()) | 593 call assert_notequal((digraph_getlist()->len()), digraph_getlist(1)->len()) |
594 endfunc | 594 endfunc |
595 " vim: shiftwidth=2 sts=2 expandtab | 595 " vim: shiftwidth=2 sts=2 expandtab |