changeset 22222:7b9e8fd7ea5b v8.2.1660

patch 8.2.1660: assert functions require passing expected as first argument Commit: https://github.com/vim/vim/commit/c0c71e9d9813f025c5fc1ce84eae309843395199 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 11 19:09:48 2020 +0200 patch 8.2.1660: assert functions require passing expected as first argument Problem: Assert functions require passing expected result as the first argument, which isn't obvious. Solution: Use a method, as in "runtest()->assert_equal(expected)".
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Sep 2020 19:15:04 +0200
parents 62e64e020878
children dc7da37a0a7d
files src/testdir/test_vim9_func.vim src/version.c
diffstat 2 files changed, 203 insertions(+), 202 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -10,7 +10,7 @@ func Test_def_basic()
   def SomeFunc(): string
     return 'yes'
   enddef
-  call assert_equal('yes', SomeFunc())
+  call SomeFunc()->assert_equal('yes')
 endfunc
 
 def ReturnString(): string
@@ -28,8 +28,8 @@ def ReturnGlobal(): number
 enddef
 
 def Test_return_something()
-  assert_equal('string', ReturnString())
-  assert_equal(123, ReturnNumber())
+  ReturnString()->assert_equal('string')
+  ReturnNumber()->assert_equal(123)
   assert_fails('ReturnGlobal()', 'E1029: Expected number but got string', '', 1, 'ReturnGlobal')
 enddef
 
@@ -69,7 +69,7 @@ enddef
 
 def Test_return_nothing()
   ReturnNothing()
-  assert_equal(1, s:nothing)
+  s:nothing->assert_equal(1)
 enddef
 
 func Increment()
@@ -82,8 +82,8 @@ def Test_call_ufunc_count()
   Increment()
   Increment()
   # works with and without :call
-  assert_equal(4, g:counter)
-  call assert_equal(4, g:counter)
+  g:counter->assert_equal(4)
+  eval g:counter->assert_equal(4)
   unlet g:counter
 enddef
 
@@ -96,9 +96,9 @@ def MyVarargs(arg: string, ...rest: list
 enddef
 
 def Test_call_varargs()
-  assert_equal('one', MyVarargs('one'))
-  assert_equal('one,two', MyVarargs('one', 'two'))
-  assert_equal('one,two,three', MyVarargs('one', 'two', 'three'))
+  MyVarargs('one')->assert_equal('one')
+  MyVarargs('one', 'two')->assert_equal('one,two')
+  MyVarargs('one', 'two', 'three')->assert_equal('one,two,three')
 enddef
 
 def MyDefaultArgs(name = 'string'): string
@@ -110,13 +110,13 @@ def MyDefaultSecond(name: string, second
 enddef
 
 def Test_call_default_args()
-  assert_equal('string', MyDefaultArgs())
-  assert_equal('one', MyDefaultArgs('one'))
+  MyDefaultArgs()->assert_equal('string')
+  MyDefaultArgs('one')->assert_equal('one')
   assert_fails('MyDefaultArgs("one", "two")', 'E118:', '', 3, 'Test_call_default_args')
 
-  assert_equal('test', MyDefaultSecond('test'))
-  assert_equal('test', MyDefaultSecond('test', true))
-  assert_equal('none', MyDefaultSecond('test', false))
+  MyDefaultSecond('test')->assert_equal('test')
+  MyDefaultSecond('test', true)->assert_equal('test')
+  MyDefaultSecond('test', false)->assert_equal('none')
 
   CheckScriptFailure(['def Func(arg: number = asdf)', 'enddef', 'defcompile'], 'E1001:')
   CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: argument 1: type mismatch, expected number but got string')
@@ -126,7 +126,7 @@ def Test_nested_function()
   def Nested(arg: string): string
     return 'nested ' .. arg
   enddef
-  assert_equal('nested function', Nested('function'))
+  Nested('function')->assert_equal('nested function')
 
   CheckDefFailure(['def Nested()', 'enddef', 'Nested(66)'], 'E118:')
   CheckDefFailure(['def Nested(arg: string)', 'enddef', 'Nested()'], 'E119:')
@@ -154,8 +154,8 @@ def Test_nested_function()
 enddef
 
 func Test_call_default_args_from_func()
-  call assert_equal('string', MyDefaultArgs())
-  call assert_equal('one', MyDefaultArgs('one'))
+  call MyDefaultArgs()->assert_equal('string')
+  call MyDefaultArgs('one')->assert_equal('one')
   call assert_fails('call MyDefaultArgs("one", "two")', 'E118:', '', 3, 'Test_call_default_args_from_func')
 endfunc
 
@@ -169,13 +169,13 @@ def Test_nested_global_function()
       enddef
       defcompile
       Outer()
-      assert_equal('inner', g:Inner())
+      g:Inner()->assert_equal('inner')
       delfunc g:Inner
       Outer()
-      assert_equal('inner', g:Inner())
+      g:Inner()->assert_equal('inner')
       delfunc g:Inner
       Outer()
-      assert_equal('inner', g:Inner())
+      g:Inner()->assert_equal('inner')
       delfunc g:Inner
   END
   CheckScriptSuccess(lines)
@@ -217,8 +217,8 @@ def Test_global_local_function()
       def Func(): string
           return 'local'
       enddef
-      assert_equal('global', g:Func())
-      assert_equal('local', Func())
+      g:Func()->assert_equal('global')
+      Func()->assert_equal('local')
   END
   CheckScriptSuccess(lines)
 
@@ -263,9 +263,9 @@ enddef
 
 def Test_call_def_varargs()
   assert_fails('MyDefVarargs()', 'E119:', '', 1, 'Test_call_def_varargs')
-  assert_equal('one,foo', MyDefVarargs('one'))
-  assert_equal('one,two', MyDefVarargs('one', 'two'))
-  assert_equal('one,two,three', MyDefVarargs('one', 'two', 'three'))
+  MyDefVarargs('one')->assert_equal('one,foo')
+  MyDefVarargs('one', 'two')->assert_equal('one,two')
+  MyDefVarargs('one', 'two', 'three')->assert_equal('one,two,three')
   CheckDefFailure(['MyDefVarargs("one", 22)'],
       'E1013: argument 2: type mismatch, expected string but got number')
   CheckDefFailure(['MyDefVarargs("one", "two", 123)'],
@@ -320,7 +320,7 @@ enddef
 def Test_call_call()
   let l = [3, 2, 1]
   call('reverse', [l])
-  assert_equal([1, 2, 3], l)
+  l->assert_equal([1, 2, 3])
 enddef
 
 let s:value = ''
@@ -341,24 +341,24 @@ def Test_func_type_varargs()
   let RefDefArg: func(?string)
   RefDefArg = FuncOneDefArg
   RefDefArg()
-  assert_equal('text', s:value)
+  s:value->assert_equal('text')
   RefDefArg('some')
-  assert_equal('some', s:value)
+  s:value->assert_equal('some')
 
   let RefDef2Arg: func(?number, ?string): string
   RefDef2Arg = FuncTwoDefArg
-  assert_equal('123text', RefDef2Arg())
-  assert_equal('99text', RefDef2Arg(99))
-  assert_equal('77some', RefDef2Arg(77, 'some'))
+  RefDef2Arg()->assert_equal('123text')
+  RefDef2Arg(99)->assert_equal('99text')
+  RefDef2Arg(77, 'some')->assert_equal('77some')
 
   CheckDefFailure(['let RefWrong: func(string?)'], 'E1010:')
   CheckDefFailure(['let RefWrong: func(?string, string)'], 'E1007:')
 
   let RefVarargs: func(...list<string>): string
   RefVarargs = FuncVarargs
-  assert_equal('', RefVarargs())
-  assert_equal('one', RefVarargs('one'))
-  assert_equal('one,two', RefVarargs('one', 'two'))
+  RefVarargs()->assert_equal('')
+  RefVarargs('one')->assert_equal('one')
+  RefVarargs('one', 'two')->assert_equal('one,two')
 
   CheckDefFailure(['let RefWrong: func(...list<string>, string)'], 'E110:')
   CheckDefFailure(['let RefWrong: func(...list<string>, ?string)'], 'E110:')
@@ -370,9 +370,9 @@ def MyVarargsOnly(...args: list<string>)
 enddef
 
 def Test_call_varargs_only()
-  assert_equal('', MyVarargsOnly())
-  assert_equal('one', MyVarargsOnly('one'))
-  assert_equal('one,two', MyVarargsOnly('one', 'two'))
+  MyVarargsOnly()->assert_equal('')
+  MyVarargsOnly('one')->assert_equal('one')
+  MyVarargsOnly('one', 'two')->assert_equal('one,two')
   CheckDefFailure(['MyVarargsOnly(1)'], 'E1013: argument 1: type mismatch, expected string but got number')
   CheckDefFailure(['MyVarargsOnly("one", 2)'], 'E1013: argument 2: type mismatch, expected string but got number')
 enddef
@@ -395,16 +395,16 @@ def Test_assign_to_argument()
   # works for dict and list
   let d: dict<string> = {}
   DictArg(d)
-  assert_equal('value', d['key'])
+  d['key']->assert_equal('value')
   let l: list<string> = []
   ListArg(l)
-  assert_equal('value', l[0])
+  l[0]->assert_equal('value')
 
   CheckScriptFailure(['def Func(arg: number)', 'arg = 3', 'enddef', 'defcompile'], 'E1090:')
 enddef
 
 def Test_call_func_defined_later()
-  assert_equal('one', g:DefinedLater('one'))
+  g:DefinedLater('one')->assert_equal('one')
   assert_fails('NotDefined("one")', 'E117:', '', 2, 'Test_call_func_defined_later')
 enddef
 
@@ -413,7 +413,7 @@ func DefinedLater(arg)
 endfunc
 
 def Test_call_funcref()
-  assert_equal(3, g:SomeFunc('abc'))
+  g:SomeFunc('abc')->assert_equal(3)
   assert_fails('NotAFunc()', 'E117:', '', 2, 'Test_call_funcref') # comment after call
   assert_fails('g:NotAFunc()', 'E117:', '', 3, 'Test_call_funcref')
 
@@ -423,7 +423,7 @@ def Test_call_funcref()
       return 123
     enddef
     let Funcref: func: number = function('RetNumber')
-    assert_equal(123, Funcref())
+    Funcref()->assert_equal(123)
   END
   CheckScriptSuccess(lines)
 
@@ -436,7 +436,7 @@ def Test_call_funcref()
       return F()
     enddef
     let Funcref = function('RetNumber')
-    assert_equal(123, Bar(Funcref))
+    Bar(Funcref)->assert_equal(123)
   END
   CheckScriptSuccess(lines)
 
@@ -466,9 +466,9 @@ def Test_call_funcref()
     enddef
     let Funcref: func(?number) = function('EchoNr')
     Funcref()
-    assert_equal(34, g:echo)
+    g:echo->assert_equal(34)
     Funcref(123)
-    assert_equal(123, g:echo)
+    g:echo->assert_equal(123)
   END
   CheckScriptSuccess(lines)
 
@@ -479,9 +479,9 @@ def Test_call_funcref()
     enddef
     let Funcref: func(...list<number>) = function('EchoList')
     Funcref()
-    assert_equal([], g:echo)
+    g:echo->assert_equal([])
     Funcref(1, 2, 3)
-    assert_equal([1, 2, 3], g:echo)
+    g:echo->assert_equal([1, 2, 3])
   END
   CheckScriptSuccess(lines)
 
@@ -493,17 +493,17 @@ def Test_call_funcref()
       return nr
     enddef
     let Funcref: func(number, ?number, ...list<number>): number = function('OptAndVar')
-    assert_equal(10, Funcref(10))
-    assert_equal(12, g:optarg)
-    assert_equal([], g:listarg)
+    Funcref(10)->assert_equal(10)
+    g:optarg->assert_equal(12)
+    g:listarg->assert_equal([])
 
-    assert_equal(11, Funcref(11, 22))
-    assert_equal(22, g:optarg)
-    assert_equal([], g:listarg)
+    Funcref(11, 22)->assert_equal(11)
+    g:optarg->assert_equal(22)
+    g:listarg->assert_equal([])
 
-    assert_equal(17, Funcref(17, 18, 1, 2, 3))
-    assert_equal(18, g:optarg)
-    assert_equal([1, 2, 3], g:listarg)
+    Funcref(17, 18, 1, 2, 3)->assert_equal(17)
+    g:optarg->assert_equal(18)
+    g:listarg->assert_equal([1, 2, 3])
   END
   CheckScriptSuccess(lines)
 enddef
@@ -604,68 +604,68 @@ def Test_vim9script_call()
        var = arg
     enddef
     MyFunc('foobar')
-    assert_equal('foobar', var)
+    var->assert_equal('foobar')
 
     let str = 'barfoo'
     str->MyFunc()
-    assert_equal('barfoo', var)
+    var->assert_equal('barfoo')
 
     g:value = 'value'
     g:value->MyFunc()
-    assert_equal('value', var)
+    var->assert_equal('value')
 
     let listvar = []
     def ListFunc(arg: list<number>)
        listvar = arg
     enddef
     [1, 2, 3]->ListFunc()
-    assert_equal([1, 2, 3], listvar)
+    listvar->assert_equal([1, 2, 3])
 
     let dictvar = {}
     def DictFunc(arg: dict<number>)
        dictvar = arg
     enddef
     {'a': 1, 'b': 2}->DictFunc()
-    assert_equal(#{a: 1, b: 2}, dictvar)
+    dictvar->assert_equal(#{a: 1, b: 2})
     def CompiledDict()
       {'a': 3, 'b': 4}->DictFunc()
     enddef
     CompiledDict()
-    assert_equal(#{a: 3, b: 4}, dictvar)
+    dictvar->assert_equal(#{a: 3, b: 4})
 
     #{a: 3, b: 4}->DictFunc()
-    assert_equal(#{a: 3, b: 4}, dictvar)
+    dictvar->assert_equal(#{a: 3, b: 4})
 
     ('text')->MyFunc()
-    assert_equal('text', var)
+    var->assert_equal('text')
     ("some")->MyFunc()
-    assert_equal('some', var)
+    var->assert_equal('some')
 
     # line starting with single quote is not a mark
     # line starting with double quote can be a method call
     'asdfasdf'->MyFunc()
-    assert_equal('asdfasdf', var)
+    var->assert_equal('asdfasdf')
     "xyz"->MyFunc()
-    assert_equal('xyz', var)
+    var->assert_equal('xyz')
 
     def UseString()
       'xyork'->MyFunc()
     enddef
     UseString()
-    assert_equal('xyork', var)
+    var->assert_equal('xyork')
 
     def UseString2()
       "knife"->MyFunc()
     enddef
     UseString2()
-    assert_equal('knife', var)
+    var->assert_equal('knife')
 
     # prepending a colon makes it a mark
     new
     setline(1, ['aaa', 'bbb', 'ccc'])
     normal! 3Gmt1G
     :'t
-    assert_equal(3, getcurpos()[1])
+    getcurpos()[1]->assert_equal(3)
     bwipe!
 
     MyFunc(
@@ -770,9 +770,9 @@ def Test_redef_failure()
   so Xdef
   delete('Xdef')
 
-  assert_equal(0, g:Func0())
-  assert_equal('Func1', g:Func1())
-  assert_equal('Func2', g:Func2())
+  g:Func0()->assert_equal(0)
+  g:Func1()->assert_equal('Func1')
+  g:Func2()->assert_equal('Func2')
 
   delfunc! Func0
   delfunc! Func1
@@ -823,12 +823,12 @@ func Test_InternalFuncRetType()
   call writefile(lines, 'Xscript')
   source Xscript
 
-  call assert_equal(2.0, RetFloat())
-  call assert_equal([['k', 'v']], RetListAny())
-  call assert_equal(['a', 'b', 'c'], RetListString())
-  call assert_notequal([], RetListDictAny())
-  call assert_notequal({}, RetDictNumber())
-  call assert_notequal({}, RetDictString())
+  call RetFloat()->assert_equal(2.0)
+  call RetListAny()->assert_equal([['k', 'v']])
+  call RetListString()->assert_equal(['a', 'b', 'c'])
+  call RetListDictAny()->assert_notequal([])
+  call RetDictNumber()->assert_notequal({})
+  call RetDictString()->assert_notequal({})
   call delete('Xscript')
 endfunc
 
@@ -895,28 +895,28 @@ def Test_func_type()
   s:funcResult = 0
   Ref1 = FuncNoArgNoRet
   Ref1()
-  assert_equal(11, s:funcResult)
+  s:funcResult->assert_equal(11)
 
   let Ref2: func
   s:funcResult = 0
   Ref2 = FuncNoArgNoRet
   Ref2()
-  assert_equal(11, s:funcResult)
+  s:funcResult->assert_equal(11)
 
   s:funcResult = 0
   Ref2 = FuncOneArgNoRet
   Ref2(12)
-  assert_equal(12, s:funcResult)
+  s:funcResult->assert_equal(12)
 
   s:funcResult = 0
   Ref2 = FuncNoArgRetNumber
-  assert_equal(1234, Ref2())
-  assert_equal(22, s:funcResult)
+  Ref2()->assert_equal(1234)
+  s:funcResult->assert_equal(22)
 
   s:funcResult = 0
   Ref2 = FuncOneArgRetNumber
-  assert_equal(13, Ref2(13))
-  assert_equal(13, s:funcResult)
+  Ref2(13)->assert_equal(13)
+  s:funcResult->assert_equal(13)
 enddef
 
 def Test_repeat_return_type()
@@ -924,13 +924,13 @@ def Test_repeat_return_type()
   for n in repeat([1], 3)
     res += n
   endfor
-  assert_equal(3, res)
+  res->assert_equal(3)
 
   res = 0
   for n in add([1, 2], 3)
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 enddef
 
 def Test_argv_return_type()
@@ -939,7 +939,7 @@ def Test_argv_return_type()
   for name in argv()
     res ..= name
   endfor
-  assert_equal('fileonefiletwo', res)
+  res->assert_equal('fileonefiletwo')
 enddef
 
 def Test_func_type_part()
@@ -987,14 +987,14 @@ enddef
 def Test_func_return_type()
   let nr: number
   nr = FuncNoArgRetNumber()
-  assert_equal(1234, nr)
+  nr->assert_equal(1234)
 
   nr = FuncOneArgRetAny(122)
-  assert_equal(122, nr)
+  nr->assert_equal(122)
 
   let str: string
   str = FuncOneArgRetAny('yes')
-  assert_equal('yes', str)
+  str->assert_equal('yes')
 
   CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1012: type mismatch, expected string but got number')
 enddef
@@ -1016,17 +1016,17 @@ def MultiLineComment(
 enddef
 
 def Test_multiline()
-  assert_equal('text1234', MultiLine('text'))
-  assert_equal('text777', MultiLine('text', 777))
-  assert_equal('text777one', MultiLine('text', 777, 'one'))
-  assert_equal('text777one-two', MultiLine('text', 777, 'one', 'two'))
+  MultiLine('text')->assert_equal('text1234')
+  MultiLine('text', 777)->assert_equal('text777')
+  MultiLine('text', 777, 'one')->assert_equal('text777one')
+  MultiLine('text', 777, 'one', 'two')->assert_equal('text777one-two')
 enddef
 
 func Test_multiline_not_vim9()
-  call assert_equal('text1234', MultiLine('text'))
-  call assert_equal('text777', MultiLine('text', 777))
-  call assert_equal('text777one', MultiLine('text', 777, 'one'))
-  call assert_equal('text777one-two', MultiLine('text', 777, 'one', 'two'))
+  call MultiLine('text')->assert_equal('text1234')
+  call MultiLine('text', 777)->assert_equal('text777')
+  call MultiLine('text', 777, 'one')->assert_equal('text777one')
+  call MultiLine('text', 777, 'one', 'two')->assert_equal('text777one-two')
 endfunc
 
 
@@ -1041,7 +1041,7 @@ func Test_E1056_1059()
   catch /E1056:/
     let caught_1056 = 1
   endtry
-  call assert_equal(1, caught_1056)
+  eval caught_1056->assert_equal(1)
 
   let caught_1059 = 0
   try
@@ -1051,7 +1051,7 @@ func Test_E1056_1059()
   catch /E1059:/
     let caught_1059 = 1
   endtry
-  call assert_equal(1, caught_1059)
+  eval caught_1059->assert_equal(1)
 endfunc
 
 func DelMe()
@@ -1074,8 +1074,8 @@ def Test_error_reporting()
     source Xdef
     assert_report('should have failed')
   catch /E476:/
-    assert_match('Invalid command: invalid', v:exception)
-    assert_match(', line 3$', v:throwpoint)
+    v:exception->assert_match('Invalid command: invalid')
+    v:throwpoint->assert_match(', line 3$')
   endtry
 
   # comment lines after the start of the function
@@ -1094,8 +1094,8 @@ def Test_error_reporting()
     source Xdef
     assert_report('should have failed')
   catch /E476:/
-    assert_match('Invalid command: invalid', v:exception)
-    assert_match(', line 4$', v:throwpoint)
+    v:exception->assert_match('Invalid command: invalid')
+    v:throwpoint->assert_match(', line 4$')
   endtry
 
   lines =<< trim END
@@ -1113,7 +1113,7 @@ def Test_error_reporting()
     source Xdef
     assert_report('should have failed')
   catch /E716:/
-    assert_match('_Func, line 3$', v:throwpoint)
+    v:throwpoint->assert_match('_Func, line 3$')
   endtry
 
   call delete('Xdef')
@@ -1138,7 +1138,7 @@ enddef
 
 def Test_closure_simple()
   let local = 'some '
-  assert_equal('some more', RefFunc({s -> local .. s}))
+  RefFunc({s -> local .. s})->assert_equal('some more')
 enddef
 
 def MakeRef()
@@ -1148,7 +1148,7 @@ enddef
 
 def Test_closure_ref_after_return()
   MakeRef()
-  assert_equal('some thing', g:Ref('thing'))
+  g:Ref('thing')->assert_equal('some thing')
   unlet g:Ref
 enddef
 
@@ -1160,11 +1160,11 @@ enddef
 
 def Test_closure_two_refs()
   MakeTwoRefs()
-  assert_equal('some', join(g:Read(), ' '))
+  join(g:Read(), ' ')->assert_equal('some')
   g:Extend('more')
-  assert_equal('some more', join(g:Read(), ' '))
+  join(g:Read(), ' ')->assert_equal('some more')
   g:Extend('even')
-  assert_equal('some more even', join(g:Read(), ' '))
+  join(g:Read(), ' ')->assert_equal('some more even')
 
   unlet g:Extend
   unlet g:Read
@@ -1180,11 +1180,11 @@ enddef
 
 def Test_closure_two_indirect_refs()
   MakeTwoRefs()
-  assert_equal('some', ReadRef(g:Read))
+  ReadRef(g:Read)->assert_equal('some')
   ExtendRef(g:Extend, 'more')
-  assert_equal('some more', ReadRef(g:Read))
+  ReadRef(g:Read)->assert_equal('some more')
   ExtendRef(g:Extend, 'even')
-  assert_equal('some more even', ReadRef(g:Read))
+  ReadRef(g:Read)->assert_equal('some more even')
 
   unlet g:Extend
   unlet g:Read
@@ -1202,10 +1202,10 @@ enddef
 
 def Test_closure_using_argument()
   MakeArgRefs('arg_val')
-  assert_equal('arg_val/loc_val/call_val', g:UseArg('call_val'))
+  g:UseArg('call_val')->assert_equal('arg_val/loc_val/call_val')
 
   MakeArgRefsVarargs('arg_val', 'one', 'two')
-  assert_equal('arg_val/the_loc/call_val/one two', g:UseVararg('call_val'))
+  g:UseVararg('call_val')->assert_equal('arg_val/the_loc/call_val/one two')
 
   unlet g:UseArg
   unlet g:UseVararg
@@ -1227,11 +1227,11 @@ enddef
 
 def Test_closure_append_get()
   MakeGetAndAppendRefs()
-  assert_equal('a', g:Get())
+  g:Get()->assert_equal('a')
   g:Append('-b')
-  assert_equal('a-b', g:Get())
+  g:Get()->assert_equal('a-b')
   g:Append('-c')
-  assert_equal('a-b-c', g:Get())
+  g:Get()->assert_equal('a-b-c')
 
   unlet g:Append
   unlet g:Get
@@ -1242,7 +1242,7 @@ def Test_nested_closure()
   def Closure(arg: string): string
     return local .. arg
   enddef
-  assert_equal('text!!!', Closure('!!!'))
+  Closure('!!!')->assert_equal('text!!!')
 enddef
 
 func GetResult(Ref)
@@ -1252,7 +1252,7 @@ endfunc
 def Test_call_closure_not_compiled()
   let text = 'text'
   g:Ref = {s ->  s .. text}
-  assert_equal('sometext', GetResult(g:Ref))
+  GetResult(g:Ref)->assert_equal('sometext')
 enddef
 
 def Test_sort_return_type()
@@ -1262,18 +1262,18 @@ enddef
 
 def Test_getqflist_return_type()
   let l = getqflist()
-  assert_equal([], l)
+  l->assert_equal([])
 
   let d = getqflist(#{items: 0})
-  assert_equal(#{items: []}, d)
+  d->assert_equal(#{items: []})
 enddef
 
 def Test_getloclist_return_type()
   let l = getloclist(1)
-  assert_equal([], l)
+  l->assert_equal([])
 
   let d = getloclist(1, #{items: 0})
-  assert_equal(#{items: []}, d)
+  d->assert_equal(#{items: []})
 enddef
 
 def Test_copy_return_type()
@@ -1282,14 +1282,14 @@ def Test_copy_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 
   let dl = deepcopy([1, 2, 3])
   res = 0
   for n in dl
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 
   dl = deepcopy([1, 2, 3], true)
 enddef
@@ -1300,7 +1300,7 @@ def Test_extend_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 enddef
 
 def Test_garbagecollect()
@@ -1313,12 +1313,12 @@ def Test_insert_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 enddef
 
 def Test_keys_return_type()
   const var: list<string> = #{a: 1, b: 2}->keys()
-  assert_equal(['a', 'b'], var)
+  var->assert_equal(['a', 'b'])
 enddef
 
 def Test_reverse_return_type()
@@ -1327,7 +1327,7 @@ def Test_reverse_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 enddef
 
 def Test_remove_return_type()
@@ -1336,7 +1336,7 @@ def Test_remove_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(3, res)
+  res->assert_equal(3)
 enddef
 
 def Test_filter_return_type()
@@ -1345,26 +1345,26 @@ def Test_filter_return_type()
   for n in l
     res += n
   endfor
-  assert_equal(6, res)
+  res->assert_equal(6)
 enddef
 
 def Test_bufnr()
   let buf = bufnr()
-  assert_equal(buf, bufnr('%'))
+  bufnr('%')->assert_equal(buf)
 
   buf = bufnr('Xdummy', true)
-  assert_notequal(-1, buf)
+  buf->assert_notequal(-1)
   exe 'bwipe! ' .. buf
 enddef
 
 def Test_col()
   new
   setline(1, 'asdf')
-  assert_equal(5, col([1, '$']))
+  col([1, '$'])->assert_equal(5)
 enddef
 
 def Test_char2nr()
-  assert_equal(12354, char2nr('あ', true))
+  char2nr('あ', true)->assert_equal(12354)
 enddef
 
 def Test_getreg_return_type()
@@ -1389,7 +1389,7 @@ def Line_continuation_in_def(dir: string
 enddef
 
 def Test_line_continuation_in_def()
-  assert_equal('full', Line_continuation_in_def('.'))
+  Line_continuation_in_def('.')->assert_equal('full')
 enddef
 
 def Line_continuation_in_lambda(): list<number>
@@ -1401,7 +1401,7 @@ def Line_continuation_in_lambda(): list<
 enddef
 
 def Test_line_continuation_in_lambda()
-  assert_equal(['D', 'C', 'B', 'A'], Line_continuation_in_lambda())
+  Line_continuation_in_lambda()->assert_equal(['D', 'C', 'B', 'A'])
 enddef
 
 func Test_silent_echo()
@@ -1430,9 +1430,9 @@ endfunc
 
 def Test_bufname()
   split SomeFile
-  assert_equal('SomeFile', bufname('%'))
+  bufname('%')->assert_equal('SomeFile')
   edit OtherFile
-  assert_equal('SomeFile', bufname('#'))
+  bufname('#')->assert_equal('SomeFile')
   close
 enddef
 
@@ -1442,7 +1442,7 @@ def Test_bufwinid()
   let SomeFileID = win_getid()
   below split OtherFile
   below split SomeFile
-  assert_equal(SomeFileID, bufwinid('SomeFile'))
+  bufwinid('SomeFile')->assert_equal(SomeFileID)
 
   win_gotoid(origwin)
   only
@@ -1451,19 +1451,19 @@ def Test_bufwinid()
 enddef
 
 def Test_count()
-  assert_equal(3, count('ABC ABC ABC', 'b', true))
-  assert_equal(0, count('ABC ABC ABC', 'b', false))
+  count('ABC ABC ABC', 'b', true)->assert_equal(3)
+  count('ABC ABC ABC', 'b', false)->assert_equal(0)
 enddef
 
 def Test_expand()
   split SomeFile
-  assert_equal(['SomeFile'], expand('%', true, true))
+  expand('%', true, true)->assert_equal(['SomeFile'])
   close
 enddef
 
 def Test_getbufinfo()
   let bufinfo = getbufinfo(bufnr())
-  assert_equal(bufinfo, getbufinfo('%'))
+  getbufinfo('%')->assert_equal(bufinfo)
 
   edit Xtestfile1
   hide edit Xtestfile2
@@ -1479,7 +1479,7 @@ def Test_getbufline()
   e #
   let lines = ['aaa', 'bbb', 'ccc']
   setbufline(buf, 1, lines)
-  assert_equal(lines, getbufline('#', 1, '$'))
+  getbufline('#', 1, '$')->assert_equal(lines)
 
   bwipe!
 enddef
@@ -1488,57 +1488,57 @@ def Test_getchangelist()
   new
   setline(1, 'some text')
   let changelist = bufnr()->getchangelist()
-  assert_equal(changelist, getchangelist('%'))
+  getchangelist('%')->assert_equal(changelist)
   bwipe!
 enddef
 
 def Test_getchar()
   while getchar(0)
   endwhile
-  assert_equal(0, getchar(true))
+  getchar(true)->assert_equal(0)
 enddef
 
 def Test_getcompletion()
   set wildignore=*.vim,*~
   let l = getcompletion('run', 'file', true)
-  assert_equal([], l)
+  l->assert_equal([])
   set wildignore&
 enddef
 
 def Test_getreg()
   let lines = ['aaa', 'bbb', 'ccc']
   setreg('a', lines)
-  assert_equal(lines, getreg('a', true, true))
+  getreg('a', true, true)->assert_equal(lines)
 enddef
 
 def Test_glob()
-  assert_equal(['runtest.vim'], glob('runtest.vim', true, true, true))
+  glob('runtest.vim', true, true, true)->assert_equal(['runtest.vim'])
 enddef
 
 def Test_globpath()
-  assert_equal(['./runtest.vim'], globpath('.', 'runtest.vim', true, true, true))
+  globpath('.', 'runtest.vim', true, true, true)->assert_equal(['./runtest.vim'])
 enddef
 
 def Test_has()
-  assert_equal(1, has('eval', true))
+  has('eval', true)->assert_equal(1)
 enddef
 
 def Test_hasmapto()
-  assert_equal(0, hasmapto('foobar', 'i', true))
+  hasmapto('foobar', 'i', true)->assert_equal(0)
   iabbrev foo foobar
-  assert_equal(1, hasmapto('foobar', 'i', true))
+  hasmapto('foobar', 'i', true)->assert_equal(1)
   iunabbrev foo
 enddef
 
 def Test_index()
-  assert_equal(3, index(['a', 'b', 'a', 'B'], 'b', 2, true))
+  index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3)
 enddef
 
 def Test_list2str_str2list_utf8()
   let s = "\u3042\u3044"
   let l = [0x3042, 0x3044]
-  assert_equal(l, str2list(s, true))
-  assert_equal(s, list2str(l, true))
+  str2list(s, true)->assert_equal(l)
+  list2str(l, true)->assert_equal(s)
 enddef
 
 def SID(): number
@@ -1550,7 +1550,7 @@ enddef
 def Test_maparg()
   let lnum = str2nr(expand('<sflnum>'))
   map foo bar
-  assert_equal(#{
+  maparg('foo', '', false, true)->assert_equal(#{
         lnum: lnum + 1,
         script: 0,
         mode: ' ',
@@ -1562,19 +1562,18 @@ def Test_maparg()
         expr: 0,
         sid: SID(),
         rhs: 'bar',
-        buffer: 0},
-        maparg('foo', '', false, true))
+        buffer: 0})
   unmap foo
 enddef
 
 def Test_mapcheck()
   iabbrev foo foobar
-  assert_equal('foobar', mapcheck('foo', 'i', true))
+  mapcheck('foo', 'i', true)->assert_equal('foobar')
   iunabbrev foo
 enddef
 
 def Test_nr2char()
-  assert_equal('a', nr2char(97, true))
+  nr2char(97, true)->assert_equal('a')
 enddef
 
 def Test_readdir()
@@ -1587,14 +1586,14 @@ def Test_search()
   setline(1, ['foo', 'bar'])
   let val = 0
   # skip expr returns boolean
-  assert_equal(2, search('bar', 'W', 0, 0, {-> val == 1}))
+  search('bar', 'W', 0, 0, {-> val == 1})->assert_equal(2)
   :1
-  assert_equal(0, search('bar', 'W', 0, 0, {-> val == 0}))
+  search('bar', 'W', 0, 0, {-> val == 0})->assert_equal(0)
   # skip expr returns number, only 0 and 1 are accepted
   :1
-  assert_equal(2, search('bar', 'W', 0, 0, {-> 0}))
+  search('bar', 'W', 0, 0, {-> 0})->assert_equal(2)
   :1
-  assert_equal(0, search('bar', 'W', 0, 0, {-> 1}))
+  search('bar', 'W', 0, 0, {-> 1})->assert_equal(0)
   assert_fails("search('bar', '', 0, 0, {-> -1})", 'E1023:')
   assert_fails("search('bar', '', 0, 0, {-> -1})", 'E1023:')
 enddef
@@ -1603,33 +1602,33 @@ def Test_searchcount()
   new
   setline(1, "foo bar")
   :/foo
-  assert_equal(#{
-      exact_match: 1,
-      current: 1,
-      total: 1,
-      maxcount: 99,
-      incomplete: 0,
-    }, searchcount(#{recompute: true}))
+  searchcount(#{recompute: true})
+      ->assert_equal(#{
+          exact_match: 1,
+          current: 1,
+          total: 1,
+          maxcount: 99,
+          incomplete: 0})
   bwipe!
 enddef
 
 def Test_searchdecl()
-  assert_equal(1, searchdecl('blah', true, true))
+  searchdecl('blah', true, true)->assert_equal(1)
 enddef
 
 def Test_setbufvar()
-   setbufvar(bufnr('%'), '&syntax', 'vim')
-   assert_equal('vim', &syntax)
-   setbufvar(bufnr('%'), '&ts', 16)
-   assert_equal(16, &ts)
-   settabwinvar(1, 1, '&syntax', 'vam')
-   assert_equal('vam', &syntax)
-   settabwinvar(1, 1, '&ts', 15)
-   assert_equal(15, &ts)
-   setlocal ts=8
+  setbufvar(bufnr('%'), '&syntax', 'vim')
+  &syntax->assert_equal('vim')
+  setbufvar(bufnr('%'), '&ts', 16)
+  &ts->assert_equal(16)
+  settabwinvar(1, 1, '&syntax', 'vam')
+  &syntax->assert_equal('vam')
+  settabwinvar(1, 1, '&ts', 15)
+  &ts->assert_equal(15)
+  setlocal ts=8
 
-   setbufvar('%', 'myvar', 123)
-   assert_equal(123, getbufvar('%', 'myvar'))
+  setbufvar('%', 'myvar', 123)
+  getbufvar('%', 'myvar')->assert_equal(123)
 enddef
 
 def Test_setloclist()
@@ -1643,7 +1642,7 @@ def Test_setreg()
   setreg('a', ['aaa', 'bbb', 'ccc'])
   let reginfo = getreginfo('a')
   setreg('a', reginfo)
-  assert_equal(reginfo, getreginfo('a'))
+  getreginfo('a')->assert_equal(reginfo)
 enddef 
 
 def Test_spellsuggest()
@@ -1671,13 +1670,13 @@ def Test_submatch()
   let Rep = {-> range(10)->map({_, v -> submatch(v, true)})->string()}
   let actual = substitute('A123456789', pat, Rep, '')
   let expected = "[['A123456789'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]"
-  assert_equal(expected, actual)
+  actual->assert_equal(expected)
 enddef
 
 def Test_synID()
   new
   setline(1, "text")
-  assert_equal(0, synID(1, 1, true))
+  synID(1, 1, true)->assert_equal(0)
   bwipe!
 enddef
 
@@ -1686,7 +1685,7 @@ def Test_term_gettty()
     MissingFeature 'terminal'
   else
     let buf = Run_shell_in_terminal({})
-    assert_notequal('', term_gettty(buf, true))
+    term_gettty(buf, true)->assert_notequal('')
     StopShellInTerminal(buf)
   endif
 enddef
@@ -1698,7 +1697,7 @@ def Test_term_start()
     botright new
     let winnr = winnr()
     term_start(&shell, #{curwin: true})
-    assert_equal(winnr, winnr())
+    winnr()->assert_equal(winnr)
     bwipe!
   endif
 enddef
@@ -1707,7 +1706,7 @@ def Test_timer_paused()
   let id = timer_start(50, {-> 0})
   timer_pause(id, true)
   let info = timer_info(id)
-  assert_equal(1, info[0]['paused'])
+  info[0]['paused']->assert_equal(1)
   timer_stop(id)
 enddef
 
@@ -1728,7 +1727,7 @@ def Fibonacci(n: number): number
 enddef
 
 def Test_recursive_call()
-  assert_equal(6765, Fibonacci(20))
+  Fibonacci(20)->assert_equal(6765)
 enddef
 
 def TreeWalk(dir: string): list<any>
@@ -1745,7 +1744,7 @@ def Test_closure_in_map()
   writefile(['222'], 'XclosureDir/file2')
   writefile(['333'], 'XclosureDir/tdir/file3')
 
-  assert_equal(['file1', 'file2', {'tdir': ['file3']}], TreeWalk('XclosureDir'))
+  TreeWalk('XclosureDir')->assert_equal(['file1', 'file2', {'tdir': ['file3']}])
 
   delete('XclosureDir', 'rf')
 enddef
@@ -1753,19 +1752,19 @@ enddef
 def Test_partial_call()
   let Xsetlist = function('setloclist', [0])
   Xsetlist([], ' ', {'title': 'test'})
-  assert_equal({'title': 'test'}, getloclist(0, {'title': 1}))
+  getloclist(0, {'title': 1})->assert_equal({'title': 'test'})
 
   Xsetlist = function('setloclist', [0, [], ' '])
   Xsetlist({'title': 'test'})
-  assert_equal({'title': 'test'}, getloclist(0, {'title': 1}))
+  getloclist(0, {'title': 1})->assert_equal({'title': 'test'})
 
   Xsetlist = function('setqflist')
   Xsetlist([], ' ', {'title': 'test'})
-  assert_equal({'title': 'test'}, getqflist({'title': 1}))
+  getqflist({'title': 1})->assert_equal({'title': 'test'})
 
   Xsetlist = function('setqflist', [[], ' '])
   Xsetlist({'title': 'test'})
-  assert_equal({'title': 'test'}, getqflist({'title': 1}))
+  getqflist({'title': 1})->assert_equal({'title': 'test'})
 enddef
 
 def Test_cmd_modifier()
@@ -1790,7 +1789,7 @@ def Test_restore_modifiers()
       Func()
   END
   CheckScriptSuccess(lines)
-  assert_equal('', g:ei_after)
+  g:ei_after->assert_equal('')
 enddef
 
 def StackTop()
@@ -1809,7 +1808,7 @@ def Test_callstack_def()
   try
     StackTop()
   catch
-    assert_match('Test_callstack_def\[2\]..StackTop\[4\]..StackBot, line 2', v:throwpoint)
+    v:throwpoint->assert_match('Test_callstack_def\[2\]..StackTop\[4\]..StackBot, line 2')
   endtry
 enddef
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1660,
+/**/
     1659,
 /**/
     1658,