Mercurial > vim
comparison src/testdir/test_vim9_class.vim @ 31896:ecfabcaafc0b v9.0.1280
patch 9.0.1280: inssufficient testing for what 9.0.1265 fixes
Commit: https://github.com/vim/vim/commit/7a1bdaecf2d2a06eb06ed462e6ccae4954939fc9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 4 15:45:27 2023 +0000
patch 9.0.1280: inssufficient testing for what 9.0.1265 fixes
Problem: Inssufficient testing for what 9.0.1265 fixes.
Solution: Add a couple of test cases. (issue https://github.com/vim/vim/issues/11885)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Feb 2023 17:00:04 +0100 |
parents | 86ed5031ff2b |
children | f1a5e67e9a1b |
comparison
equal
deleted
inserted
replaced
31895:bb5c63d6020c | 31896:ecfabcaafc0b |
---|---|
1048 assert_equal('child', g:result) | 1048 assert_equal('child', g:result) |
1049 unlet g:result | 1049 unlet g:result |
1050 END | 1050 END |
1051 v9.CheckScriptSuccess(lines) | 1051 v9.CheckScriptSuccess(lines) |
1052 | 1052 |
1053 # method of interface returns a value | |
1054 lines =<< trim END | |
1055 vim9script | |
1056 interface Base | |
1057 def Enter(): string | |
1058 endinterface | |
1059 | |
1060 class Child implements Base | |
1061 def Enter(): string | |
1062 g:result ..= 'child' | |
1063 return "/resource" | |
1064 enddef | |
1065 endclass | |
1066 | |
1067 def F(obj: Base) | |
1068 var r = obj.Enter() | |
1069 g:result ..= r | |
1070 enddef | |
1071 | |
1072 g:result = '' | |
1073 F(Child.new()) | |
1074 assert_equal('child/resource', g:result) | |
1075 unlet g:result | |
1076 END | |
1077 v9.CheckScriptSuccess(lines) | |
1078 | |
1079 lines =<< trim END | |
1080 vim9script | |
1081 class Base | |
1082 def Enter(): string | |
1083 return null_string | |
1084 enddef | |
1085 endclass | |
1086 | |
1087 class Child extends Base | |
1088 def Enter(): string | |
1089 g:result ..= 'child' | |
1090 return "/resource" | |
1091 enddef | |
1092 endclass | |
1093 | |
1094 def F(obj: Base) | |
1095 var r = obj.Enter() | |
1096 g:result ..= r | |
1097 enddef | |
1098 | |
1099 g:result = '' | |
1100 F(Child.new()) | |
1101 assert_equal('child/resource', g:result) | |
1102 unlet g:result | |
1103 END | |
1104 v9.CheckScriptSuccess(lines) | |
1105 | |
1106 | |
1053 # No class that implements the interface. | 1107 # No class that implements the interface. |
1054 lines =<< trim END | 1108 lines =<< trim END |
1055 vim9script | 1109 vim9script |
1056 | 1110 |
1057 interface IWithEE | 1111 interface IWithEE |