diff src/testdir/test_vim9_cmd.vim @ 23398:40f824f5c7c7 v8.2.2242

patch 8.2.2242: Vim9: bar line continuation does not work at script level Commit: https://github.com/vim/vim/commit/8242ebbdba64cfa5c504c9d8dfb802076d99c602 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 29 11:15:01 2020 +0100 patch 8.2.2242: Vim9: bar line continuation does not work at script level Problem: Vim9: line continuation with bar does not work at script level. Solution: Check for Vim9 script.
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Dec 2020 11:15:34 +0100
parents 517fca70e084
children bb0c53f4ef8b
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -536,6 +536,37 @@ def Test_command_modifiers_keep()
   quit!
 enddef
 
+def Test_bar_line_continuation()
+  var lines =<< trim END
+      au BufNewFile Xfile g:readFile = 1
+          | g:readExtra = 2
+      g:readFile = 0
+      g:readExtra = 0
+      edit Xfile
+      assert_equal(1, g:readFile)
+      assert_equal(2, g:readExtra)
+      bwipe!
+      au! BufNewFile
+
+      au BufNewFile Xfile g:readFile = 1
+          | g:readExtra = 2
+          | g:readMore = 3
+      g:readFile = 0
+      g:readExtra = 0
+      g:readMore = 0
+      edit Xfile
+      assert_equal(1, g:readFile)
+      assert_equal(2, g:readExtra)
+      assert_equal(3, g:readMore)
+      bwipe!
+      au! BufNewFile
+      unlet g:readFile
+      unlet g:readExtra
+      unlet g:readMore
+  END
+  CheckDefAndScriptSuccess(lines)
+enddef
+
 def Test_command_modifier_other()
   new Xsomefile
   setline(1, 'changed')
@@ -548,33 +579,15 @@ def Test_command_modifier_other()
   bwipe!
 
   au BufNewFile Xfile g:readFile = 1
-      | g:readExtra = 2
   g:readFile = 0
-  g:readExtra = 0
   edit Xfile
   assert_equal(1, g:readFile)
-  assert_equal(2, g:readExtra)
   bwipe!
   g:readFile = 0
   noautocmd edit Xfile
   assert_equal(0, g:readFile)
   au! BufNewFile
-
-  au BufNewFile Xfile g:readFile = 1
-      | g:readExtra = 2
-      | g:readMore = 3
-  g:readFile = 0
-  g:readExtra = 0
-  g:readMore = 0
-  edit Xfile
-  assert_equal(1, g:readFile)
-  assert_equal(2, g:readExtra)
-  assert_equal(3, g:readMore)
-  bwipe!
-  au! BufNewFile
   unlet g:readFile
-  unlet g:readExtra
-  unlet g:readMore
 
   noswapfile edit XnoSwap
   assert_equal(0, &l:swapfile)