aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-28 07:15:33 +0800
committerGitHub <noreply@github.com>2025-03-28 07:15:33 +0800
commite1f1386d5e5db1d10e42f7779c1af1cce2690c78 (patch)
treef52f88253bcfefb21958b7236e908e13a762c52b
parentd01d4764804bd73ce213aab76a394c62c9f7d193 (diff)
parente4172bcbdf1c276e45e7f8688cac208d901c444c (diff)
downloadrneovim-e1f1386d5e5db1d10e42f7779c1af1cce2690c78.tar.gz
rneovim-e1f1386d5e5db1d10e42f7779c1af1cce2690c78.tar.bz2
rneovim-e1f1386d5e5db1d10e42f7779c1af1cce2690c78.zip
Merge pull request #33098 from zeertzjq/vim-9.1.1245
vim-patch:9.1.{1245,1249}
-rw-r--r--test/old/testdir/test_let.vim20
-rw-r--r--test/old/testdir/test_normal.vim16
2 files changed, 36 insertions, 0 deletions
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim
index 22a3a35f87..ec83de880c 100644
--- a/test/old/testdir/test_let.vim
+++ b/test/old/testdir/test_let.vim
@@ -93,6 +93,26 @@ func Test_let()
let [l[0], l[1]] = [10, 20]
call assert_equal([10, 20, 3], l)
+ " Test for using curly brace name in the LHS of an assignment
+ let listvar = [1, 2]
+ let s = 'listvar'
+ let {s} = [3, 4]
+ call assert_equal([3, 4], listvar)
+
+ " Test for using curly brace name as a list and as list index in the LHS of
+ " an assignment
+ let listvar = [1, 2]
+ let idx = 1
+ let s = 'listvar'
+ let {s}[0] = 10
+ let s = 'idx'
+ let listvar[{s}] = 20
+ call assert_equal([10, 20], listvar)
+ let s1 = 'listvar'
+ let s2 = 'idx'
+ let {s1}[{s2}] = 30
+ call assert_equal([10, 30], listvar)
+
" Test for errors in conditional expression
call assert_fails('let val = [] ? 1 : 2', 'E745:')
call assert_fails('let val = 1 ? 5+ : 6', 'E121:')
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 1d9609cbe1..b8011a81e4 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -2705,6 +2705,22 @@ func Test_normal33_g_cmd2()
call assert_equal(87, col('.'))
call assert_equal('E', getreg(0))
+ " Have an odd number of chars in the line
+ norm! A.
+ call assert_equal(145, col('.'))
+ norm! gMyl
+ call assert_equal(73, col('.'))
+ call assert_equal('0', getreg(0))
+
+ " 'listchars' "eol" should not affect gM behavior
+ setlocal list listchars=eol:$
+ norm! $
+ call assert_equal(145, col('.'))
+ norm! gMyl
+ call assert_equal(73, col('.'))
+ call assert_equal('0', getreg(0))
+ setlocal nolist
+
" Test for gM with Tab characters
call setline('.', "\ta\tb\tc\td\te\tf")
norm! gMyl