patch 9.0.1653: Amiga: default 'viewdir' may not work

Problem:    Amiga: default 'viewdir' may not work.
Solution:   Use "home:" instead of "$VIM". Add a test. (Christian Brabandt,
            closes #12576)
diff --git a/src/testdir/setup.vim b/src/testdir/setup.vim
index ca94bae..0e5088a 100644
--- a/src/testdir/setup.vim
+++ b/src/testdir/setup.vim
@@ -30,6 +30,10 @@
   " Avoid storing shell history.
   let $HISTFILE = ""
 
+  " Have current $HOME available as $ORIGHOME.  $HOME is used for option
+  " defaults before we get here, and test_mksession checks that.
+  let $ORIGHOME = $HOME
+
   " Make sure $HOME does not get read or written.
   " It must exist, gnome tries to create $HOME/.gnome2
   let $HOME = getcwd() . '/XfakeHOME'
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index 1ce5a28..0c4838e 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -1262,4 +1262,17 @@
   bw!
 endfunc
 
+" Test default 'viewdir' value
+func Test_mkview_default_home()
+  if has('win32')
+    call assert_match('^' .. $ORIGHOME .. '/vimfiles', &viewdir)
+  elseif has('unix')
+    call assert_match('^' .. $ORIGHOME .. '/.vim', &viewdir)
+  elseif has('amiga')
+    call assert_match('^home:vimfiles', &viewdir)
+  elseif has('mac')
+    call assert_match('^' .. $VIM .. '/vimfiles', &viewdir)
+  endif
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab