Răsfoiți Sursa

Fix handling of changed up-to-date msg from Git (#724)

The msg was changed from 'Already up-to-date' to 'Already up to date'.
Daniel Hahler 7 ani în urmă
părinte
comite
e6a775e0df
3 a modificat fișierele cu 13 adăugiri și 12 ștergeri
  1. 1 1
      plug.vim
  2. 3 2
      test/test.vader
  3. 9 9
      test/workflow.vader

+ 1 - 1
plug.vim

@@ -908,7 +908,7 @@ function! s:finish(pull)
     call add(msgs, "Press 'R' to retry.")
   endif
   if a:pull && len(s:update.new) < len(filter(getline(5, '$'),
-                \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0"))
+                \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'"))
     call add(msgs, "Press 'D' to see the updated changes.")
   endif
   echo join(msgs, ' ')

+ 3 - 2
test/test.vader

@@ -37,9 +37,10 @@ Execute (Initialize test environment):
     g/^$/d
   endfunction
 
-  function! AssertExpect(bang, pat, cnt)
+  function! AssertExpect(bang, pat, cnt, ...)
     let op = a:bang ? '==#' : '=~#'
-    AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
+    let args = [a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))] + a:000
+    call call('vader#assert#equal', args)
   endfunction
   command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
 

+ 9 - 9
test/workflow.vader

@@ -328,7 +328,7 @@ Execute (PlugUpdate to install both again):
 
 Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
   PlugUpdate
-  AssertExpect 'Already up-to-date', 2
+  AssertExpect 'Already up.to.date', 2, 'Expected 2 times "Already up-to-date", but got: '.string(getline(1, '$'))
   normal D
   AssertEqual '0 plugin(s) updated.', getline(1)
   q
@@ -1613,21 +1613,21 @@ Execute (#532 - Reuse plug window):
   call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['goyo.vim'].dir))
 
   PlugDiff
-  AssertEqual 1, winnr()
-  AssertEqual 2, winnr('$')
+  AssertEqual 1, winnr(), 'Current window is #1 after PlugDiff (but is '.winnr().')'
+  AssertEqual 2, winnr('$'), 'Two windows after PlugDiff (but got '.winnr('$').')'
 
   " Open preview window
   execute "normal ]]jo"
-  AssertEqual 2, winnr()
-  AssertEqual 3, winnr('$')
+  AssertEqual 2, winnr(), 'Current window is #2 after opening preview (but is '.winnr().')'
+  AssertEqual 3, winnr('$'), 'Three windows with preview (but got '.winnr('$').')'
 
   " Move plug window to the right
   wincmd L
-  AssertEqual 3, winnr()
-  AssertEqual 3, winnr('$')
+  AssertEqual 3, winnr(), 'Current window is #3 after moving window (but is '.winnr().')'
+  AssertEqual 3, winnr('$'), 'Three windows after moving window (but got '.winnr('$').')'
 
   " Reuse plug window. Preview window is closed.
   PlugStatus
-  AssertEqual 2, winnr()
-  AssertEqual 2, winnr('$')
+  AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
+  AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
   q