comparison src/testdir/test_textprop.vim @ 27457:4c16acb2525f v8.2.4257

patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent Commit: https://github.com/vim/vim/commit/62aec93bfdb9e1b40d03a6d2e8e9511f8b1bdb2d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 29 21:45:34 2022 +0000 patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent Problem: Vim9: finding global function without g: prefix but not finding global variable is inconsistent. Solution: Require using g: for a global function. Change the vim9.vim script into a Vim9 script with exports. Fix that import in legacy script does not work.
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Jan 2022 23:00:05 +0100
parents e624b4ddbdf0
children 95d6e3c9aa1e
comparison
equal deleted inserted replaced
27456:a8e2d91995ce 27457:4c16acb2525f
3 3
4 source check.vim 4 source check.vim
5 CheckFeature textprop 5 CheckFeature textprop
6 6
7 source screendump.vim 7 source screendump.vim
8 source vim9.vim 8 import './vim9.vim' as v9
9 9
10 func Test_proptype_global() 10 func Test_proptype_global()
11 call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1}) 11 call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
12 let proptypes = prop_type_list() 12 let proptypes = prop_type_list()
13 call assert_equal(1, len(proptypes)) 13 call assert_equal(1, len(proptypes))
427 prop_type_delete('comment') 427 prop_type_delete('comment')
428 enddef 428 enddef
429 429
430 def Test_prop_remove_vim9() 430 def Test_prop_remove_vim9()
431 new 431 new
432 AddPropTypes() 432 g:AddPropTypes()
433 SetupPropsInFirstLine() 433 g:SetupPropsInFirstLine()
434 assert_equal(1, prop_remove({type: 'three', id: 13, both: true, all: true})) 434 assert_equal(1, prop_remove({type: 'three', id: 13, both: true, all: true}))
435 DeletePropTypes() 435 g:DeletePropTypes()
436 bwipe! 436 bwipe!
437 enddef 437 enddef
438 438
439 func SetupOneLine() 439 func SetupOneLine()
440 call setline(1, 'xonex xtwoxx') 440 call setline(1, 'xonex xtwoxx')
1702 1702
1703 " Tests for the prop_list() function 1703 " Tests for the prop_list() function
1704 func Test_prop_list() 1704 func Test_prop_list()
1705 let lines =<< trim END 1705 let lines =<< trim END
1706 new 1706 new
1707 call AddPropTypes() 1707 call g:AddPropTypes()
1708 call setline(1, repeat([repeat('a', 60)], 10)) 1708 call setline(1, repeat([repeat('a', 60)], 10))
1709 call prop_add(1, 4, {'type': 'one', 'id': 5, 'end_col': 6}) 1709 call prop_add(1, 4, {'type': 'one', 'id': 5, 'end_col': 6})
1710 call prop_add(1, 5, {'type': 'two', 'id': 10, 'end_col': 7}) 1710 call prop_add(1, 5, {'type': 'two', 'id': 10, 'end_col': 7})
1711 call prop_add(3, 12, {'type': 'one', 'id': 20, 'end_col': 14}) 1711 call prop_add(3, 12, {'type': 'one', 'id': 20, 'end_col': 14})
1712 call prop_add(3, 13, {'type': 'two', 'id': 10, 'end_col': 15}) 1712 call prop_add(3, 13, {'type': 'two', 'id': 10, 'end_col': 15})
1842 \ 'types': ['one', 'two'], 'ids': [5, 10], 'end_lnum': -1})) 1842 \ 'types': ['one', 'two'], 'ids': [5, 10], 'end_lnum': -1}))
1843 #" get text properties from an unloaded buffer 1843 #" get text properties from an unloaded buffer
1844 bunload! Xaaa 1844 bunload! Xaaa
1845 call assert_equal([], prop_list(1, {'bufnr': bnr, 'end_lnum': -1})) 1845 call assert_equal([], prop_list(1, {'bufnr': bnr, 'end_lnum': -1}))
1846 1846
1847 call DeletePropTypes() 1847 call g:DeletePropTypes()
1848 :%bw! 1848 :%bw!
1849 END 1849 END
1850 call CheckLegacyAndVim9Success(lines) 1850 call v9.CheckLegacyAndVim9Success(lines)
1851 endfunc 1851 endfunc
1852 1852
1853 " vim: shiftwidth=2 sts=2 expandtab 1853 " vim: shiftwidth=2 sts=2 expandtab