patch 8.2.1293: Vim9: error when using vim9script in TextYankPost

Problem:    Vim9: error when using vim9script in TextYankPost.
Solution:   Use EX_LOCKOK instead of the EX_CMDWIN flag for command that can
            be used when text is locked. (closes #6529)
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index f7d195e..ac76e8d 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1708,6 +1708,10 @@
   assert_equal('execute-var-var', getline(1))
   bwipe!
 
+  let n = true
+  execute 'echomsg' (n ? '"true"' : '"no"')
+  assert_match('^true$', Screenline(&lines))
+
   call CheckDefFailure(['execute xxx'], 'E1001:')
   call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
 enddef
@@ -2634,6 +2638,32 @@
   quit
 enddef
 
+" test using a vim9script that is auto-loaded from an autocmd
+def Test_vim9_autoload()
+  let lines =<< trim END
+     vim9script
+     def foo#test()
+         echomsg getreg('"')
+     enddef
+  END
+
+  mkdir('Xdir/autoload', 'p')
+  writefile(lines, 'Xdir/autoload/foo.vim')
+  let save_rtp = &rtp
+  exe 'set rtp^=' .. getcwd() .. '/Xdir'
+  augroup test
+    autocmd TextYankPost * call foo#test()
+  augroup END
+
+  normal Y
+
+  augroup test
+    autocmd!
+  augroup END
+  delete('Xdir', 'rf')
+  &rtp = save_rtp
+enddef
+
 " Keep this last, it messes up highlighting.
 def Test_substitute_cmd()
   new