Mercurial > vim
diff src/testdir/test_vim9_expr.vim @ 20207:3c247d9cd6f9 v8.2.0659
patch 8.2.0659: Vim9: no test for equal func type
Commit: https://github.com/vim/vim/commit/939b5db4808770d3a2ec35e3902a9d5165adc0cf
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Apr 28 22:49:08 2020 +0200
patch 8.2.0659: Vim9: no test for equal func type
Problem: Vim9: no test for equal func type.
Solution: Add a test. Improve type check.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 Apr 2020 23:00:04 +0200 |
parents | 5a397db2c1ed |
children | ce1b73835822 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -30,6 +30,16 @@ def Test_expr1() assert_equal('two', {} ? 'one' : 'two') var = 0 assert_equal('two', var ? 'one' : 'two') + + let Some: func = function('len') + let Other: func = function('winnr') + let Res: func = g:atrue ? Some : Other + assert_equal(function('len'), Res) + + let RetOne: func(string): number = function('len') + let RetTwo: func(string): number = function('winnr') + let RetThat: func = g:atrue ? RetOne : RetTwo + assert_equal(function('len'), RetThat) enddef func Test_expr1_fails()