Mercurial > vim
diff src/testdir/test_vim9_class.vim @ 33636:53416c49a7ab v9.0.2059
patch 9.0.2059: outstanding exceptions may be skipped
Commit: https://github.com/vim/vim/commit/0ab500dede4edd8d5aee7ddc63444537be527871
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Oct 21 11:59:42 2023 +0200
patch 9.0.2059: outstanding exceptions may be skipped
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Oct 2023 12:15:03 +0200 |
parents | 41c64cb748c1 |
children | fcc8296f36eb |
line wrap: on
line diff
--- 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 def Hello(): string - return hello + static str: string = '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