patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off

Problem:    "gN" doesn't work on last match with 'wrapscan' off. (fcpg)
Solution:   Adjust for searching backward. (Christian Brabandt)
diff --git a/src/testdir/test_gn.vim b/src/testdir/test_gn.vim
index b2a2937..f56e707 100644
--- a/src/testdir/test_gn.vim
+++ b/src/testdir/test_gn.vim
@@ -111,6 +111,15 @@
   call assert_equal(['foo  baz'], getline(1,'$'))
   sil! %d_
 
+  " search upwards with nowrapscan set
+  call setline('.', ['foo', 'bar', 'foo', 'baz'])
+  set nowrapscan
+  let @/='foo'
+  $
+  norm! dgN
+  call assert_equal(['foo', 'bar', '', 'baz'], getline(1,'$'))
+  sil! %d_
+
   set wrapscan&vim
   set belloff&vim
 endfu