diff options
Diffstat (limited to 'mnv/src/testdir/test_startup_utf8.mnv')
| -rw-r--r-- | mnv/src/testdir/test_startup_utf8.mnv | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/mnv/src/testdir/test_startup_utf8.mnv b/mnv/src/testdir/test_startup_utf8.mnv new file mode 100644 index 0000000000..84e56de6f7 --- /dev/null +++ b/mnv/src/testdir/test_startup_utf8.mnv @@ -0,0 +1,108 @@ +" Tests for startup using utf-8. + +source util/screendump.mnv + +func Test_read_stdin_utf8() + let linesin = ['テスト', '€ÀÈÌÒÙ'] + call writefile(linesin, 'Xtestin', 'D') + let before = [ + \ 'set enc=utf-8', + \ 'set fencs=cp932,utf-8', + \ ] + let after = [ + \ 'write ++enc=utf-8 Xtestout', + \ 'quit!', + \ ] + if has('win32') + let pipecmd = 'type Xtestin | ' + else + let pipecmd = 'cat Xtestin | ' + endif + if RunMNVPiped(before, after, '-', pipecmd) + let lines = readfile('Xtestout') + call assert_equal(linesin, lines) + else + call assert_equal('', 'RunMNVPiped failed.') + endif + + call delete('Xtestout') +endfunc + +func Test_read_fifo_utf8() + CheckUnix + " Using bash/zsh's process substitution. + if executable('bash') + set shell=bash + elseif executable('zsh') + set shell=zsh + else + throw 'Skipped: bash or zsh is required' + endif + let linesin = ['テスト', '€ÀÈÌÒÙ'] + call writefile(linesin, 'Xtestin', 'D') + let before = [ + \ 'set enc=utf-8', + \ 'set fencs=cp932,utf-8', + \ ] + let after = [ + \ 'write ++enc=utf-8 Xtestout', + \ 'quit!', + \ ] + if RunMNV(before, after, '<(cat Xtestin)') + let lines = readfile('Xtestout') + call assert_equal(linesin, lines) + else + call assert_equal('', 'RunMNV failed.') + endif + + call delete('Xtestout') +endfunc + +func Test_detect_fifo() + CheckUnix + " On OpenBSD /dev/fd/n files are character special, not FIFO + CheckNotOpenBSD + " Using bash/zsh's process substitution. + if executable('bash') + set shell=bash + elseif executable('zsh') + set shell=zsh + else + throw 'Skipped: bash or zsh is required' + endif + let linesin = ['one', 'two'] + call writefile(linesin, 'Xtestin_fifo', 'D') + let after = [ + \ 'call writefile(split(execute(":mess"), "\\n"), "Xtestout")', + \ 'quit!', + \ ] + if RunMNV([], after, '<(cat Xtestin_fifo)') + let lines = readfile('Xtestout') + call assert_match('\[fifo\]', lines[0]) + call assert_match('\[fifo\]', lines[1]) + else + call assert_equal('', 'RunMNV failed.') + endif + + call delete('Xtestout') +endfunc + +func Test_detect_ambiwidth() + CheckRunMNVInTerminal + + " Use the title termcap entries to output the escape sequence. + call writefile([ + \ 'set enc=utf-8', + \ 'set ambiwidth=double', + \ 'call test_option_not_set("ambiwidth")', + \ 'redraw', + \ ], 'Xscript', 'D') + let buf = RunMNVInTerminal('-S Xscript', #{keep_t_u7: 1}) + call TermWait(buf) + call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>") + call WaitForAssert({-> assert_match('single', term_getline(buf, 1))}) + + call StopMNVInTerminal(buf) +endfunc + +" mnv: shiftwidth=2 sts=2 expandtab |
