patch 9.1.0797: testing of options can be further improved

Problem:  testing of options can be further improved
Solution: split the generated option test into test_options_all.vim,
          add more test cases, save and restore values, fix use-after-free

closes: #15894

Signed-off-by: Milly <milly.ca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index eec71ef..cbc84a4 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -4,6 +4,8 @@
 source check.vim
 source view_util.vim
 
+scriptencoding utf-8
+
 func Test_whichwrap()
   set whichwrap=b,s
   call assert_equal('b,s', &whichwrap)
@@ -1037,15 +1039,6 @@
   call assert_equal(sort(copy(options)), options)
 endfunc
 
-func Test_set_values()
-  " opt_test.vim is generated from ../optiondefs.h using gen_opt_test.vim
-  if filereadable('opt_test.vim')
-    source opt_test.vim
-  else
-    throw 'Skipped: opt_test.vim does not exist'
-  endif
-endfunc
-
 func Test_renderoptions()
   " Only do this for Windows Vista and later, fails on Windows XP and earlier.
   " Doesn't hurt to do this on a non-Windows system.