changeset 16346:2fb516abde42 v8.1.1178

patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown commit https://github.com/vim/vim/commit/4945219b99f8e191c599f80dedc0c4be02ed821e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 17 16:27:02 2019 +0200 patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown Problem: When mouse click tests fails value of 'ttytype' is unknown. Solution: Add a message to the assert.
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Apr 2019 16:30:08 +0200
parents bd4b10cf331c
children b390b2e66f46
files src/testdir/test_termcodes.vim src/version.c
diffstat 2 files changed, 47 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -51,14 +51,15 @@ func Test_xterm_mouse_click()
   call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer'])
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     go
-    call assert_equal([0, 1, 1, 0], getpos('.'))
+    call assert_equal([0, 1, 1, 0], getpos('.'), msg)
     let row = 2
     let col = 6
     call MouseLeftClick(row, col)
     call MouseLeftRelease(row, col)
-    call assert_equal([0, 2, 6, 0], getpos('.'))
+    call assert_equal([0, 2, 6, 0], getpos('.'), msg)
   endfor
 
   let &mouse = save_mouse
@@ -76,26 +77,27 @@ func Test_xterm_mouse_wheel()
   call setline(1, range(1, 100))
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     go
-    call assert_equal(1, line('w0'))
-    call assert_equal([0, 1, 1, 0], getpos('.'))
+    call assert_equal(1, line('w0'), msg)
+    call assert_equal([0, 1, 1, 0], getpos('.'), msg)
 
     call MouseWheelDown(1, 1)
-    call assert_equal(4, line('w0'))
-    call assert_equal([0, 4, 1, 0], getpos('.'))
+    call assert_equal(4, line('w0'), msg)
+    call assert_equal([0, 4, 1, 0], getpos('.'), msg)
 
     call MouseWheelDown(1, 1)
-    call assert_equal(7, line('w0'))
-    call assert_equal([0, 7, 1, 0], getpos('.'))
+    call assert_equal(7, line('w0'), msg)
+    call assert_equal([0, 7, 1, 0], getpos('.'), msg)
 
     call MouseWheelUp(1, 1)
-    call assert_equal(4, line('w0'))
-    call assert_equal([0, 7, 1, 0], getpos('.'))
+    call assert_equal(4, line('w0'), msg)
+    call assert_equal([0, 7, 1, 0], getpos('.'), msg)
 
     call MouseWheelUp(1, 1)
-    call assert_equal(1, line('w0'))
-    call assert_equal([0, 7, 1, 0], getpos('.'))
+    call assert_equal(1, line('w0'), msg)
+    call assert_equal([0, 7, 1, 0], getpos('.'), msg)
   endfor
 
   let &mouse = save_mouse
@@ -111,6 +113,7 @@ func Test_xterm_mouse_drag_window_separa
   set mouse=a term=xterm
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
 
     " Split horizontally and test dragging the horizontal window separator.
@@ -124,12 +127,12 @@ func Test_xterm_mouse_drag_window_separa
       call MouseLeftClick(row, col)
       let row -= 1
       call MouseLeftDrag(row, col)
-      call assert_equal(rowseparator - 1, winheight(0) + 1)
+      call assert_equal(rowseparator - 1, winheight(0) + 1, msg)
       let row += 1
       call MouseLeftDrag(row, col)
-      call assert_equal(rowseparator, winheight(0) + 1)
+      call assert_equal(rowseparator, winheight(0) + 1, msg)
       call MouseLeftRelease(row, col)
-      call assert_equal(rowseparator, winheight(0) + 1)
+      call assert_equal(rowseparator, winheight(0) + 1, msg)
     endif
     bwipe!
 
@@ -144,12 +147,12 @@ func Test_xterm_mouse_drag_window_separa
       call MouseLeftClick(row, col)
       let col -= 1
       call MouseLeftDrag(row, col)
-      call assert_equal(colseparator - 1, winwidth(0) + 1)
+      call assert_equal(colseparator - 1, winwidth(0) + 1, msg)
       let col += 1
       call MouseLeftDrag(row, col)
-      call assert_equal(colseparator, winwidth(0) + 1)
+      call assert_equal(colseparator, winwidth(0) + 1, msg)
       call MouseLeftRelease(row, col)
-      call assert_equal(colseparator, winwidth(0) + 1)
+      call assert_equal(colseparator, winwidth(0) + 1, msg)
     endif
     bwipe!
   endfor
@@ -167,9 +170,10 @@ func Test_xterm_mouse_drag_statusline()
   set mouse=a term=xterm laststatus=2
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
 
-    call assert_equal(1, &cmdheight)
+    call assert_equal(1, &cmdheight, msg)
     let rowstatusline = winheight(0) + 1
     let row = rowstatusline
     let col = 1
@@ -182,15 +186,15 @@ func Test_xterm_mouse_drag_statusline()
     call MouseLeftClick(row, col)
     let row -= 1
     call MouseLeftDrag(row, col)
-    call assert_equal(2, &cmdheight)
-    call assert_equal(rowstatusline - 1, winheight(0) + 1)
+    call assert_equal(2, &cmdheight, msg)
+    call assert_equal(rowstatusline - 1, winheight(0) + 1, msg)
     let row += 1
     call MouseLeftDrag(row, col)
-    call assert_equal(1, &cmdheight)
-    call assert_equal(rowstatusline, winheight(0) + 1)
+    call assert_equal(1, &cmdheight, msg)
+    call assert_equal(rowstatusline, winheight(0) + 1, msg)
     call MouseLeftRelease(row, col)
-    call assert_equal(1, &cmdheight)
-    call assert_equal(rowstatusline, winheight(0) + 1)
+    call assert_equal(1, &cmdheight, msg)
+    call assert_equal(rowstatusline, winheight(0) + 1, msg)
   endfor
 
   let &mouse = save_mouse
@@ -207,6 +211,7 @@ func Test_xterm_mouse_click_tab()
   let row = 1
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     e Xfoo
     tabnew Xbar
@@ -215,7 +220,7 @@ func Test_xterm_mouse_click_tab()
     call assert_equal(['Tab page 1',
         \              '    Xfoo',
         \              'Tab page 2',
-        \              '>   Xbar'], a)
+        \              '>   Xbar'], a, msg)
 
     " Test clicking on tab names in the tabline at the top.
     let col = 2
@@ -226,7 +231,7 @@ func Test_xterm_mouse_click_tab()
     call assert_equal(['Tab page 1',
         \              '>   Xfoo',
         \              'Tab page 2',
-        \              '    Xbar'], a)
+        \              '    Xbar'], a, msg)
 
     let col = 9
     call MouseLeftClick(row, col)
@@ -235,7 +240,7 @@ func Test_xterm_mouse_click_tab()
     call assert_equal(['Tab page 1',
         \              '    Xfoo',
         \              'Tab page 2',
-        \              '>   Xbar'], a)
+        \              '>   Xbar'], a, msg)
 
     %bwipe!
   endfor
@@ -258,6 +263,7 @@ func Test_xterm_mouse_click_X_to_close_t
       " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported.
       continue
     endif
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     e Xtab1
     tabnew Xtab2
@@ -270,7 +276,7 @@ func Test_xterm_mouse_click_X_to_close_t
         \              'Tab page 2',
         \              '>   Xtab2',
         \              'Tab page 3',
-        \              '    Xtab3'], a)
+        \              '    Xtab3'], a, msg)
 
     " Click on "X" in tabline to close current tab i.e. Xtab2.
     redraw
@@ -280,7 +286,7 @@ func Test_xterm_mouse_click_X_to_close_t
     call assert_equal(['Tab page 1',
         \              '    Xtab1',
         \              'Tab page 2',
-        \              '>   Xtab3'], a)
+        \              '>   Xtab3'], a, msg)
 
     %bwipe!
   endfor
@@ -299,6 +305,7 @@ func Test_xterm_mouse_drag_to_move_tab()
   let row = 1
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     e Xtab1
     tabnew Xtab2
@@ -307,14 +314,14 @@ func Test_xterm_mouse_drag_to_move_tab()
     call assert_equal(['Tab page 1',
         \              '    Xtab1',
         \              'Tab page 2',
-        \              '>   Xtab2'], a)
+        \              '>   Xtab2'], a, msg)
     redraw
 
     " Click in tab2 and drag it to tab1.
     " Check getcharmod() to verify that click is not
     " interpreted as a spurious double-click.
     call MouseLeftClick(row, 10)
-    call assert_equal(0, getcharmod())
+    call assert_equal(0, getcharmod(), msg)
     for col in [9, 8, 7, 6]
       call MouseLeftDrag(row, col)
     endfor
@@ -323,7 +330,7 @@ func Test_xterm_mouse_drag_to_move_tab()
     call assert_equal(['Tab page 1',
         \              '>   Xtab2',
         \              'Tab page 2',
-        \              '    Xtab1'], a)
+        \              '    Xtab1'], a, msg)
 
     " brief sleep to avoid causing a double-click
     sleep 20m
@@ -347,6 +354,7 @@ func Test_xterm_mouse_double_click_to_cr
   let col = 10
 
   for ttymouse_val in ['xterm', 'sgr']
+    let msg = 'ttymouse=' .. ttymouse_val
     exe 'set ttymouse=' . ttymouse_val
     e Xtab1
     tabnew Xtab2
@@ -355,16 +363,16 @@ func Test_xterm_mouse_double_click_to_cr
     call assert_equal(['Tab page 1',
         \              '    Xtab1',
         \              'Tab page 2',
-        \              '>   Xtab2'], a)
+        \              '>   Xtab2'], a, msg)
 
     redraw
     call MouseLeftClick(row, col)
     " Check getcharmod() to verify that first click is not
     " interpreted as a spurious double-click.
-    call assert_equal(0, getcharmod())
+    call assert_equal(0, getcharmod(), msg)
     call MouseLeftRelease(row, col)
     call MouseLeftClick(row, col)
-    call assert_equal(32, getcharmod()) " double-click
+    call assert_equal(32, getcharmod(), msg) " double-click
     call MouseLeftRelease(row, col)
     let a = split(execute(':tabs'), "\n")
     call assert_equal(['Tab page 1',
@@ -372,7 +380,7 @@ func Test_xterm_mouse_double_click_to_cr
         \              'Tab page 2',
         \              '>   [No Name]',
         \              'Tab page 3',
-        \              '    Xtab2'], a)
+        \              '    Xtab2'], a, msg)
 
     if ttymouse_val !=# 'sgr'
       " We need to sleep, or else MouseLeftClick() in next loop
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1178,
+/**/
     1177,
 /**/
     1176,