comparison src/testdir/test_vim9_script.vim @ 21652:befb512e0762 v8.2.1376

patch 8.2.1376: Vim9: expression mapping causes error for using :import Commit: https://github.com/vim/vim/commit/803af686e23c7bb17273bb0c78ff0bf97e8d23f4 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 5 16:20:03 2020 +0200 patch 8.2.1376: Vim9: expression mapping causes error for using :import Problem: Vim9: expression mapping causes error for using :import. Solution: Add EX_LOCK_OK to :import and :export. (closes 3606)
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Aug 2020 16:30:03 +0200
parents 33fec2448697
children 60ba361a7fdb
comparison
equal deleted inserted replaced
21651:0993a0c9af26 21652:befb512e0762
1349 set cpo&vim 1349 set cpo&vim
1350 assert_equal(&cpo, g:cpo_in_vim9script) 1350 assert_equal(&cpo, g:cpo_in_vim9script)
1351 delete('Xvim9_script') 1351 delete('Xvim9_script')
1352 enddef 1352 enddef
1353 1353
1354 func g:Trigger()
1355 source Ximport.vim
1356 return "echo 'yes'\<CR>"
1357 endfunc
1358
1359 def Test_import_export_expr_map()
1360 # check that :import and :export work when buffer is locked
1361 let export_lines =<< trim END
1362 vim9script
1363 export def That(): string
1364 return 'yes'
1365 enddef
1366 END
1367 writefile(export_lines, 'Xexport_that.vim')
1368
1369 let import_lines =<< trim END
1370 vim9script
1371 import That from './Xexport_that.vim'
1372 assert_equal('yes', That())
1373 END
1374 writefile(import_lines, 'Ximport.vim')
1375
1376 nnoremap <expr> trigger g:Trigger()
1377 feedkeys('trigger', "xt")
1378
1379 delete('Xexport.vim')
1380 delete('Ximport.vim')
1381 nunmap trigger
1382 enddef
1383
1354 def Test_vim9script_fails() 1384 def Test_vim9script_fails()
1355 CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:') 1385 CheckScriptFailure(['scriptversion 2', 'vim9script'], 'E1039:')
1356 CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:') 1386 CheckScriptFailure(['vim9script', 'scriptversion 2'], 'E1040:')
1357 CheckScriptFailure(['export let some = 123'], 'E1042:') 1387 CheckScriptFailure(['export let some = 123'], 'E1042:')
1358 CheckScriptFailure(['import some from "./Xexport.vim"'], 'E1048:') 1388 CheckScriptFailure(['import some from "./Xexport.vim"'], 'E1048:')