patch 8.1.1112: duplicate code in quickfix file

Problem:    Duplicate code in quickfix file.
Solution:   Move code into functions. (Yegappan Lakshmanan, closes #4207)
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index da8b4f0..bb25e64 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -163,6 +163,12 @@
 func XageTests(cchar)
   call s:setup_commands(a:cchar)
 
+  if a:cchar == 'l'
+    " No location list for the current window
+    call assert_fails('lolder', 'E776:')
+    call assert_fails('lnewer', 'E776:')
+  endif
+
   let list = [{'bufnr': bufnr('%'), 'lnum': 1}]
   call g:Xsetlist(list)