]> granicus.if.org Git - vim/commitdiff
patch 8.0.0943: MS-Windows: Test_terminal_scrape_multibyte may fail v8.0.0943
authorBram Moolenaar <Bram@vim.org>
Mon, 14 Aug 2017 21:07:30 +0000 (23:07 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 14 Aug 2017 21:07:30 +0000 (23:07 +0200)
Problem:    Test_terminal_scrape_multibyte fails if the codepage is not utf-8.
Solution:   Start "cmd" with the utf-8 codepage. (micbou, closes #1975)

src/testdir/test_terminal.vim
src/version.c

index e77be352f6cc9d3b8ae42aae08d95cc6f7754a09..fe3d7df6781ca0f212ca43a7561d541f4ae7e982 100644 (file)
@@ -185,14 +185,19 @@ func Test_terminal_scrape_multibyte()
   endif
   call writefile(["léttまrs"], 'Xtext')
   if has('win32')
-    let cmd = 'cmd /c "type Xtext"'
+    " Run cmd with UTF-8 codepage to make the type command print the expected
+    " multibyte characters.
+    let g:buf = term_start("cmd /K chcp 65001")
+    call term_sendkeys(g:buf, "type Xtext\<CR>")
+    call term_sendkeys(g:buf, "exit\<CR>")
+    let g:line = 4
   else
-    let cmd = "cat Xtext"
+    let g:buf = term_start("cat Xtext")
+    let g:line = 1
   endif
-  let g:buf = term_start(cmd)
 
-  call WaitFor('term_scrape(g:buf, 1)[0].chars == "l"')
-  let l = term_scrape(g:buf, 1)
+  call WaitFor('term_scrape(g:buf, g:line)[0].chars == "l"')
+  let l = term_scrape(g:buf, g:line)
   call assert_true(len(l) >= 7)
   call assert_equal('l', l[0].chars)
   call assert_equal('é', l[1].chars)
@@ -210,6 +215,7 @@ func Test_terminal_scrape_multibyte()
 
   exe g:buf . 'bwipe'
   unlet g:buf
+  unlet g:line
   call delete('Xtext')
 endfunc
 
index 263b00492fdda09457899f9e3438a62097195faa..1bb02a1ccf50584333365cb24358cf4c09e84bc7 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    943,
 /**/
     942,
 /**/