mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.2.0221: no test for Vim9 += and ..=
Problem: No test for Vim9 += and ..=. Solution: Add tests.
This commit is contained in:
@@ -27,6 +27,9 @@ func Test_def_basic()
|
|||||||
call assert_equal('yes', SomeFunc())
|
call assert_equal('yes', SomeFunc())
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
let s:appendToMe = 'xxx'
|
||||||
|
let s:addToMe = 111
|
||||||
|
|
||||||
def Test_assignment()
|
def Test_assignment()
|
||||||
let bool1: bool = true
|
let bool1: bool = true
|
||||||
assert_equal(v:true, bool1)
|
assert_equal(v:true, bool1)
|
||||||
@@ -44,11 +47,16 @@ def Test_assignment()
|
|||||||
let dict2: dict<number> = #{one: 1, two: 2}
|
let dict2: dict<number> = #{one: 1, two: 2}
|
||||||
|
|
||||||
v:char = 'abc'
|
v:char = 'abc'
|
||||||
call assert_equal('abc', v:char)
|
assert_equal('abc', v:char)
|
||||||
|
|
||||||
$ENVVAR = 'foobar'
|
$ENVVAR = 'foobar'
|
||||||
call assert_equal('foobar', $ENVVAR)
|
assert_equal('foobar', $ENVVAR)
|
||||||
$ENVVAR = ''
|
$ENVVAR = ''
|
||||||
|
|
||||||
|
appendToMe ..= 'yyy'
|
||||||
|
assert_equal('xxxyyy', appendToMe)
|
||||||
|
addToMe += 222
|
||||||
|
assert_equal(333, addToMe)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
func Test_assignment_failure()
|
func Test_assignment_failure()
|
||||||
@@ -195,6 +203,7 @@ let s:export_script_lines =<< trim END
|
|||||||
|
|
||||||
export const CONST = 1234
|
export const CONST = 1234
|
||||||
export let exported = 9876
|
export let exported = 9876
|
||||||
|
export let exp_name = 'John'
|
||||||
export def Exported(): string
|
export def Exported(): string
|
||||||
return 'Exported'
|
return 'Exported'
|
||||||
enddef
|
enddef
|
||||||
@@ -205,7 +214,14 @@ def Test_vim9script()
|
|||||||
vim9script
|
vim9script
|
||||||
import {exported, Exported} from './Xexport.vim'
|
import {exported, Exported} from './Xexport.vim'
|
||||||
g:imported = exported
|
g:imported = exported
|
||||||
|
exported += 3
|
||||||
|
g:imported_added = exported
|
||||||
g:imported_func = Exported()
|
g:imported_func = Exported()
|
||||||
|
|
||||||
|
import {exp_name} from './Xexport.vim'
|
||||||
|
g:imported_name = exp_name
|
||||||
|
exp_name ..= ' Doe'
|
||||||
|
g:imported_name_appended = exp_name
|
||||||
END
|
END
|
||||||
|
|
||||||
writefile(import_script_lines, 'Ximport.vim')
|
writefile(import_script_lines, 'Ximport.vim')
|
||||||
@@ -216,13 +232,18 @@ def Test_vim9script()
|
|||||||
assert_equal('bobbie', g:result)
|
assert_equal('bobbie', g:result)
|
||||||
assert_equal('bob', g:localname)
|
assert_equal('bob', g:localname)
|
||||||
assert_equal(9876, g:imported)
|
assert_equal(9876, g:imported)
|
||||||
|
assert_equal(9879, g:imported_added)
|
||||||
assert_equal('Exported', g:imported_func)
|
assert_equal('Exported', g:imported_func)
|
||||||
|
assert_equal('John', g:imported_name)
|
||||||
|
assert_equal('John Doe', g:imported_name_appended)
|
||||||
assert_false(exists('g:name'))
|
assert_false(exists('g:name'))
|
||||||
|
|
||||||
unlet g:result
|
unlet g:result
|
||||||
unlet g:localname
|
unlet g:localname
|
||||||
unlet g:imported
|
unlet g:imported
|
||||||
|
unlet g:imported_added
|
||||||
unlet g:imported_func
|
unlet g:imported_func
|
||||||
|
unlet g:imported_name g:imported_name_appended
|
||||||
delete('Ximport.vim')
|
delete('Ximport.vim')
|
||||||
delete('Xexport.vim')
|
delete('Xexport.vim')
|
||||||
|
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
221,
|
||||||
/**/
|
/**/
|
||||||
220,
|
220,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user