patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second

Problem:    When WaitFor() has a wrong expression it just waits a second,
            which goes unnoticed. (James McCoy)
Solution:   When WaitFor() times out throw an exception.  Fix places where the
            expression was wrong.
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 95c1b98..967cd8f 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -705,7 +705,7 @@
 
   enew
   let buf = term_start(cmd, {'curwin': bufnr('')})
-  let job = term_getjob(buf)
+  let g:job = term_getjob(buf)
   call term_wait(buf, 50)
 
   " ascii + composing
@@ -742,8 +742,9 @@
   call assert_equal("\u00a0\u0308", l[3].chars)
 
   call term_sendkeys(buf, "exit\r")
-  call WaitFor('job_status(job) == "dead"')
-  call assert_equal('dead', job_status(job))
+  call WaitFor('job_status(g:job) == "dead"')
+  call assert_equal('dead', job_status(g:job))
   bwipe!
+  unlet g:job
   let &encoding = save_enc
 endfunc