summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_vim9_class.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-10-21 11:59:42 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-21 11:59:42 +0200
commit0ab500dede4edd8d5aee7ddc63444537be527871 (patch)
tree96ebb872deec1d8ef086d9a133bd5167158c52fe /src/testdir/test_vim9_class.vim
parenta36acb7ac444a789440dc30e0f04d5427069face (diff)
patch 9.0.2059: outstanding exceptions may be skippedv9.0.2059
Problem: outstanding exceptions may be skipped Solution: When restoring exception state, process remaining outstanding exceptions closes: #13386 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/testdir/test_vim9_class.vim')
-rw-r--r--src/testdir/test_vim9_class.vim45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 59d5c9316d..02e99c84c3 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -8347,10 +8347,10 @@ def Test_class_variable_as_operands()
public static TruthyFn: func
static list: list<any> = []
static four: number = 4
- static hello: string = 'hello'
+ static str: string = 'hello'
- static def Hello(): string
- return hello
+ static def Str(): string
+ return str
enddef
static def Four(): number
@@ -8374,8 +8374,17 @@ def Test_class_variable_as_operands()
assert_equal(16, 1 << Tests.four)
assert_equal(8, Tests.four + four)
assert_equal(8, four + Tests.four)
- assert_equal('hellohello', Tests.hello .. hello)
- assert_equal('hellohello', hello .. Tests.hello)
+ assert_equal('hellohello', Tests.str .. str)
+ assert_equal('hellohello', str .. Tests.str)
+
+ # Using class variable for list indexing
+ var l = range(10)
+ assert_equal(4, l[Tests.four])
+ assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2])
+
+ # Using class variable for Dict key
+ var d = {hello: 'abc'}
+ assert_equal('abc', d[Tests.str])
enddef
endclass
@@ -8390,8 +8399,17 @@ def Test_class_variable_as_operands()
assert_equal(16, 1 << Tests.four)
assert_equal(8, Tests.four + Tests.Four())
assert_equal(8, Tests.Four() + Tests.four)
- assert_equal('hellohello', Tests.hello .. Tests.Hello())
- assert_equal('hellohello', Tests.Hello() .. Tests.hello)
+ assert_equal('hellohello', Tests.str .. Tests.Str())
+ assert_equal('hellohello', Tests.Str() .. Tests.str)
+
+ # Using class variable for list indexing
+ var l = range(10)
+ assert_equal(4, l[Tests.four])
+ assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2])
+
+ # Using class variable for Dict key
+ var d = {hello: 'abc'}
+ assert_equal('abc', d[Tests.str])
enddef
Tests.TruthyFn = Tests.Truthy
@@ -8409,8 +8427,17 @@ def Test_class_variable_as_operands()
assert_equal(16, 1 << Tests.four)
assert_equal(8, Tests.four + Tests.Four())
assert_equal(8, Tests.Four() + Tests.four)
- assert_equal('hellohello', Tests.hello .. Tests.Hello())
- assert_equal('hellohello', Tests.Hello() .. Tests.hello)
+ assert_equal('hellohello', Tests.str .. Tests.Str())
+ assert_equal('hellohello', Tests.Str() .. Tests.str)
+
+ # Using class variable for list indexing
+ var l = range(10)
+ assert_equal(4, l[Tests.four])
+ assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2])
+
+ # Using class variable for Dict key
+ var d = {hello: 'abc'}
+ assert_equal('abc', d[Tests.str])
END
v9.CheckSourceSuccess(lines)
enddef