patch 8.0.1592: terminal windows in a session are not properly restored

Problem:    Terminal windows in a session are not properly restored.
Solution:   Add "terminal" in 'sessionoptions'.  When possible restore the
            command running in a terminal.
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 5fef6bd..877c5f9 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -270,3 +270,10 @@
   let line = join(chars, '')
   return matchstr(line, '^.\{-}\ze\s*$')
 endfunc
+
+" Stops the shell running in terminal "buf".
+func Stop_shell_in_terminal(buf)
+  call term_sendkeys(a:buf, "exit\r")
+  let job = term_getjob(a:buf)
+  call WaitFor({-> job_status(job) == "dead"})
+endfunc