diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-12-14 19:59:45 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-12-14 19:59:45 +0100 |
commit | d2e1c83962d4b392d1876d341c739d204553d01b (patch) | |
tree | 221708c71d8501b4e8850eed019b30d0a996955b /src/testdir | |
parent | 7349c5160ab63d0737050a6b4da3e407ab0cfeb0 (diff) |
patch 9.0.2161: Vim9: not able to use imported interfaces and classesv9.0.2161
Problem: Vim9: not able to use imported interfaces and classes
Solution: Detect imported class/interfaces names correclty
fixes: #13661
closes: #13685
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_class.vim | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index e0f5db6253..c1965880cf 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -3030,6 +3030,62 @@ def Test_class_import() v9.CheckScriptSuccess(lines) enddef +" Test for implementing an imported interface +def Test_implement_imported_interface() + var lines =<< trim END + vim9script + export interface Imp_Intf1 + def Fn1(): number + endinterface + export interface Imp_Intf2 + def Fn2(): number + endinterface + END + writefile(lines, 'Ximportinterface.vim', 'D') + + lines =<< trim END + vim9script + import './Ximportinterface.vim' as Xintf + + class A implements Xintf.Imp_Intf1, Xintf.Imp_Intf2 + def Fn1(): number + return 10 + enddef + def Fn2(): number + return 20 + enddef + endclass + var a = A.new() + assert_equal(10, a.Fn1()) + assert_equal(20, a.Fn2()) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for extending an imported class +def Test_extend_imported_class() + var lines =<< trim END + vim9script + export class Imp_C1 + def Fn1(): number + return 5 + enddef + endclass + END + writefile(lines, 'Xextendimportclass.vim', 'D') + + lines =<< trim END + vim9script + import './Xextendimportclass.vim' as XClass + + class A extends XClass.Imp_C1 + endclass + var a = A.new() + assert_equal(5, a.Fn1()) + END + v9.CheckScriptSuccess(lines) +enddef + def Test_abstract_class() var lines =<< trim END vim9script |