Mercurial > vim
comparison src/testdir/test_vim9_import.vim @ 27328:7382135dac01 v8.2.4192
patch 8.2.4192: cannot use an import in 'printexpr'
Commit: https://github.com/vim/vim/commit/7ef4a2fe3736bbeb5bad182782a74576aa06b0db
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 23 13:44:35 2022 +0000
patch 8.2.4192: cannot use an import in 'printexpr'
Problem: Cannot use an import in 'printexpr'.
Solution: Set the script context when evaluating 'printexpr'.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 23 Jan 2022 14:45:03 +0100 |
parents | a195a900a329 |
children | aeadf4315bef |
comparison
equal
deleted
inserted
replaced
27327:abd1d186f2e4 | 27328:7382135dac01 |
---|---|
872 bwipe! | 872 bwipe! |
873 set indentexpr= debug= | 873 set indentexpr= debug= |
874 delete('Xindenter') | 874 delete('Xindenter') |
875 enddef | 875 enddef |
876 | 876 |
877 func Test_import_in_printexpr() | |
878 CheckFeature postscript | |
879 call Run_Test_import_in_printexpr() | |
880 endfunc | |
881 | |
882 def Run_Test_import_in_printexpr() | |
883 var lines =<< trim END | |
884 vim9script | |
885 export def PrintFile(): bool | |
886 g:printed = 'yes' | |
887 delete('v:fname_in') | |
888 return false | |
889 enddef | |
890 END | |
891 writefile(lines, 'Xprint.vim') | |
892 | |
893 lines =<< trim END | |
894 vim9script | |
895 import './Xprint.vim' | |
896 set printexpr=Xprint.PrintFile() | |
897 END | |
898 CheckScriptSuccess(lines) | |
899 | |
900 help | |
901 hardcopy dummy args | |
902 assert_equal('yes', g:printed) | |
903 | |
904 delete('Xprint.vim') | |
905 set printexpr= | |
906 enddef | |
907 | |
877 def Test_export_fails() | 908 def Test_export_fails() |
878 CheckScriptFailure(['export var some = 123'], 'E1042:') | 909 CheckScriptFailure(['export var some = 123'], 'E1042:') |
879 CheckScriptFailure(['vim9script', 'export var g:some'], 'E1022:') | 910 CheckScriptFailure(['vim9script', 'export var g:some'], 'E1022:') |
880 CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:') | 911 CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:') |
881 | 912 |