Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 27611:e311a80f8cbe v8.2.4332
patch 8.2.4332: Vim9: incomplete test for existing script variable in block
Commit: https://github.com/vim/vim/commit/dce2441a603f2c9343a4a46091283a32420d80a2
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 8 20:35:30 2022 +0000
patch 8.2.4332: Vim9: incomplete test for existing script variable in block
Problem: Vim9: incomplete test for existing script variable in block.
Solution: Add a couple more tests. Fix uncovered problem.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 08 Feb 2022 21:45:03 +0100 |
parents | 766a329fe5bb |
children | 5c4ab8d4472c |
comparison
equal
deleted
inserted
replaced
27610:81772f743738 | 27611:e311a80f8cbe |
---|---|
1052 var name = 'piet' | 1052 var name = 'piet' |
1053 endif | 1053 endif |
1054 def FuncOne(name: string) | 1054 def FuncOne(name: string) |
1055 echo name | 1055 echo name |
1056 enddef | 1056 enddef |
1057 END | |
1058 v9.CheckScriptSuccess(lines) | |
1059 | |
1060 # with another variable in another block | |
1061 lines =<< trim END | |
1062 vim9script | |
1063 if true | |
1064 var name = 'piet' | |
1065 # define a function so that the variable isn't cleared | |
1066 def GetItem(): string | |
1067 return item | |
1068 enddef | |
1069 endif | |
1070 if true | |
1071 var name = 'peter' | |
1072 def FuncOne(name: string) | |
1073 echo name | |
1074 enddef | |
1075 endif | |
1076 END | |
1077 v9.CheckScriptFailure(lines, 'E1168:') | |
1078 | |
1079 # only variable in another block is OK | |
1080 lines =<< trim END | |
1081 vim9script | |
1082 if true | |
1083 var name = 'piet' | |
1084 # define a function so that the variable isn't cleared | |
1085 def GetItem(): string | |
1086 return item | |
1087 enddef | |
1088 endif | |
1089 if true | |
1090 def FuncOne(name: string) | |
1091 echo name | |
1092 enddef | |
1093 endif | |
1057 END | 1094 END |
1058 v9.CheckScriptSuccess(lines) | 1095 v9.CheckScriptSuccess(lines) |
1059 | 1096 |
1060 # argument name declared later is only found when compiling | 1097 # argument name declared later is only found when compiling |
1061 lines =<< trim END | 1098 lines =<< trim END |