Mercurial > vim
comparison src/testdir/test_vim9_cmd.vim @ 24490:08050e45bd06 v8.2.2785
patch 8.2.2785: Vim9: cannot redirect to local variable
Commit: https://github.com/vim/vim/commit/2d1c57ed3dd25c44b41b9ddd4cf63c01ae89007e
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 19 20:50:03 2021 +0200
patch 8.2.2785: Vim9: cannot redirect to local variable
Problem: Vim9: cannot redirect to local variable.
Solution: Compile :redir when redirecting to a variable.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 19 Apr 2021 21:00:04 +0200 |
parents | f293bb501b30 |
children | bfa495227ac6 |
comparison
equal
deleted
inserted
replaced
24489:c2b93bfb68f8 | 24490:08050e45bd06 |
---|---|
1192 CheckDefFailure(['s/from/\="x"/9'], 'E488:') | 1192 CheckDefFailure(['s/from/\="x"/9'], 'E488:') |
1193 | 1193 |
1194 bwipe! | 1194 bwipe! |
1195 enddef | 1195 enddef |
1196 | 1196 |
1197 def Test_redir_to_var() | |
1198 var result: string | |
1199 redir => result | |
1200 echo 'something' | |
1201 redir END | |
1202 assert_equal("\nsomething", result) | |
1203 | |
1204 redir =>> result | |
1205 echo 'more' | |
1206 redir END | |
1207 assert_equal("\nsomething\nmore", result) | |
1208 | |
1209 var lines =<< trim END | |
1210 redir => notexist | |
1211 END | |
1212 CheckDefFailure(lines, 'E1089:') | |
1213 enddef | |
1214 | |
1197 | 1215 |
1198 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 1216 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |