patch 9.1.0783: 'spell' option setting has problems

Problem:  'spell' option setting has problems
Solution: correctly check for comma for 'spellfile' option,
          remove unnecessary checks, refactor slightly (Milly)

closes: #15873

Signed-off-by: Milly <milly.ca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index 0d27760..4ca3c09 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -146,7 +146,11 @@
       \ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']],
       \ 'showcmdloc': [['last', 'statusline', 'tabline'], ['xxx']],
       \ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']],
-      \ 'spellfile': [['', 'file.en.add', '/tmp/dir\ with\ space/en.utf-8.add'], ['xxx', '/tmp/file']],
+      \ 'spellfile': [['', 'file.en.add', 'xxx.en.add,yyy.gb.add,zzz.ja.add',
+      \		'/tmp/dir\ with\ space/en.utf-8.add',
+      \		'/tmp/dir\\,with\\,comma/en.utf-8.add'],
+      \		['xxx', '/tmp/file', ',file.en.add', 'xxx,yyy.en.add',
+      \		'xxx.en.add,yyy,zzz.ja.add']],
       \ 'spelllang': [['', 'xxx', 'sr@latin'], ['not&lang', "that\\\rthere"]],
       \ 'spelloptions': [['', 'camel'], ['xxx']],
       \ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']],
diff --git a/src/testdir/test_spellfile.vim b/src/testdir/test_spellfile.vim
index 8abb680..dd12698 100644
--- a/src/testdir/test_spellfile.vim
+++ b/src/testdir/test_spellfile.vim
@@ -1154,7 +1154,7 @@
 " 'spellfile' accepts '@' on top of 'isfname'.
 def Test_spellfile_allow_at_character()
   mkdir('Xtest/the foo@bar,dir', 'p')
-  &spellfile = './Xtest/the foo@bar,dir/Xspellfile.add'
+  &spellfile = './Xtest/the foo@bar\,dir/Xspellfile.add'
   &spellfile = ''
   delete('Xtest', 'rf')
 enddef