patch 8.2.3321: some code is not tested

Problem:    Some code is not tested.
Solution:   Add some more tests. (Dominique Pellé, closes #8735)
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index 9200f2b..a8204ef 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -230,6 +230,14 @@
   close!
   enew | only
   call delete('Xfile')
+
+  " :saveas should detect and set the file type.
+  syntax on
+  saveas! Xsaveas.pl
+  call assert_equal('perl', &filetype)
+  syntax off
+  %bw!
+  call delete('Xsaveas.pl')
 endfunc
 
 func Test_write_errors()