patch 8.2.4726: cannot use expand() to get the script name

Problem:    Cannot use expand() to get the script name.
Solution:   Support expand('<script>'). (closes #10121)
diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim
index 638f9c7..fee5f2f 100644
--- a/src/testdir/test_expand.vim
+++ b/src/testdir/test_expand.vim
@@ -159,4 +159,54 @@
   call assert_equal('$*', expandcmd('$*'))
 endfunc
 
+func Test_expand_script_source()
+  let lines0 =<< trim [SCRIPT]
+    let g:script_level[0] = expand('<script>:t')
+    so Xscript1
+    func F0()
+      let g:func_level[0] = expand('<script>:t')
+    endfunc
+  [SCRIPT]
+
+  let lines1 =<< trim [SCRIPT]
+    let g:script_level[1] = expand('<script>:t')
+    so Xscript2
+    func F1()
+      let g:func_level[1] = expand('<script>:t')
+    endfunc
+  [SCRIPT]
+
+  let lines2 =<< trim [SCRIPT]
+    let g:script_level[2] = expand('<script>:t')
+    func F2()
+      let g:func_level[2] = expand('<script>:t')
+    endfunc
+  [SCRIPT]
+
+  call writefile(lines0, 'Xscript0')
+  call writefile(lines1, 'Xscript1')
+  call writefile(lines2, 'Xscript2')
+
+  " Check the expansion of <script> at script and function level.
+  let g:script_level = ['', '', '']
+  let g:func_level = ['', '', '']
+
+  so Xscript0
+  call F0()
+  call F1()
+  call F2()
+
+  call assert_equal(['Xscript0', 'Xscript1', 'Xscript2'], g:script_level)
+  call assert_equal(['Xscript0', 'Xscript1', 'Xscript2'], g:func_level)
+
+  unlet g:script_level g:func_level
+  delfunc F0
+  delfunc F1
+  delfunc F2
+
+  call delete('Xscript0')
+  call delete('Xscript1')
+  call delete('Xscript2')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab