diff src/testdir/test_terminal.vim @ 15406:63b02fcf1361 v8.1.0711

patch 8.1.0711: test files still use function! commit https://github.com/vim/vim/commit/1e1153600c0377472d62cc553173fe555ddcf5a7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 9 23:01:02 2019 +0100 patch 8.1.0711: test files still use function! Problem: Test files still use function!. Solution: Remove the exclamation mark. Fix overwriting a function.
author Bram Moolenaar <Bram@vim.org>
date Wed, 09 Jan 2019 23:15:05 +0100
parents 74bc96b99f4f
children 47328ce4b7aa
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -122,7 +122,7 @@ func Test_terminal_hide_buffer()
   unlet g:job
 endfunc
 
-func! s:Nasty_exit_cb(job, st)
+func s:Nasty_exit_cb(job, st)
   exe g:buf . 'bwipe!'
   let g:buf = 0
 endfunc
@@ -1727,3 +1727,27 @@ func Test_terminal_no_job()
   let term = term_start('false', {'term_finish': 'close'})
   call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
 endfunc
+
+func Test_term_gettitle()
+  if !has('title') || empty(&t_ts)
+    return
+  endif
+  " TODO: this fails on Travis
+  return
+
+  " term_gettitle() returns an empty string for a non-terminal buffer
+  " or for a non-existing buffer.
+  call assert_equal('', term_gettitle(bufnr('%')))
+  call assert_equal('', term_gettitle(bufnr('$') + 1))
+
+  let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'])
+  call WaitForAssert({-> assert_equal('[No Name] - VIM', term_gettitle(term)) })
+
+  call term_sendkeys(term, ":e Xfoo\r")
+  call WaitForAssert({-> assert_match('Xfoo (.*[/\\]testdir) - VIM', term_gettitle(term)) })
+
+  call term_sendkeys(term, ":set titlestring=foo\r")
+  call WaitForAssert({-> assert_equal('foo', term_gettitle(term)) })
+
+  exe term . 'bwipe!'
+endfunc