Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
20206:b7046165cf39 | 20207:3c247d9cd6f9 |
---|---|
28 assert_equal('two', 0z ? 'one' : 'two') | 28 assert_equal('two', 0z ? 'one' : 'two') |
29 assert_equal('two', [] ? 'one' : 'two') | 29 assert_equal('two', [] ? 'one' : 'two') |
30 assert_equal('two', {} ? 'one' : 'two') | 30 assert_equal('two', {} ? 'one' : 'two') |
31 var = 0 | 31 var = 0 |
32 assert_equal('two', var ? 'one' : 'two') | 32 assert_equal('two', var ? 'one' : 'two') |
33 | |
34 let Some: func = function('len') | |
35 let Other: func = function('winnr') | |
36 let Res: func = g:atrue ? Some : Other | |
37 assert_equal(function('len'), Res) | |
38 | |
39 let RetOne: func(string): number = function('len') | |
40 let RetTwo: func(string): number = function('winnr') | |
41 let RetThat: func = g:atrue ? RetOne : RetTwo | |
42 assert_equal(function('len'), RetThat) | |
33 enddef | 43 enddef |
34 | 44 |
35 func Test_expr1_fails() | 45 func Test_expr1_fails() |
36 call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'") | 46 call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'") |
37 call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:") | 47 call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:") |