Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 24208:7a21b2581dce v8.2.2645
patch 8.2.2645: using inline function is not properly tested
Commit: https://github.com/vim/vim/commit/49f1e9ec3e7f4e1b3572367d02a83c2b6ebbed97
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 22 20:49:02 2021 +0100
patch 8.2.2645: using inline function is not properly tested
Problem: Using inline function is not properly tested.
Solution: Add test cases, esp. for errors. Minor code improvements.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Mar 2021 21:00:03 +0100 |
parents | c50c5464e6dc |
children | bd010982f0be |
comparison
equal
deleted
inserted
replaced
24207:29ae46ae449b | 24208:7a21b2581dce |
---|---|
1959 return 'yes' | 1959 return 'yes' |
1960 endif | 1960 endif |
1961 return 'no' | 1961 return 'no' |
1962 }) | 1962 }) |
1963 assert_equal(['no', 'yes', 'no'], dll) | 1963 assert_equal(['no', 'yes', 'no'], dll) |
1964 | |
1965 sandbox var Safe = (nr: number): number => { | |
1966 return nr + 7 | |
1967 } | |
1968 assert_equal(10, Safe(3)) | |
1964 END | 1969 END |
1965 CheckDefAndScriptSuccess(lines) | 1970 CheckDefAndScriptSuccess(lines) |
1966 | 1971 |
1967 lines =<< trim END | 1972 lines =<< trim END |
1968 map([1, 2], (k, v) => { redrawt }) | 1973 map([1, 2], (k, v) => { redrawt }) |
1969 END | 1974 END |
1970 CheckDefAndScriptFailure(lines, 'E488') | 1975 CheckDefAndScriptFailure(lines, 'E488') |
1976 | |
1977 lines =<< trim END | |
1978 var Func = (nr: int) => { | |
1979 echo nr | |
1980 } | |
1981 END | |
1982 CheckDefAndScriptFailure(lines, 'E1010', 1) | |
1983 | |
1984 lines =<< trim END | |
1985 var Func = (nr: number): int => { | |
1986 return nr | |
1987 } | |
1988 END | |
1989 CheckDefAndScriptFailure(lines, 'E1010', 1) | |
1990 | |
1991 lines =<< trim END | |
1992 var Func = (nr: number): int => { | |
1993 return nr | |
1994 END | |
1995 CheckDefAndScriptFailure(lines, 'E1171', 1) # line nr is function start | |
1996 | |
1997 lines =<< trim END | |
1998 vim9script | |
1999 var Func = (nr: number): int => { | |
2000 var ll =<< ENDIT | |
2001 nothing | |
2002 END | |
2003 CheckScriptFailure(lines, 'E1145: Missing heredoc end marker: ENDIT', 2) | |
1971 enddef | 2004 enddef |
1972 | 2005 |
1973 def NewLambdaWithComments(): func | 2006 def NewLambdaWithComments(): func |
1974 return (x) => | 2007 return (x) => |
1975 # some comment | 2008 # some comment |