@@ -1238,6 +1238,77 @@ func Test_num64()
12381238 call assert_equal (rng, sort (range (0x100000001 , 0xFFFFffff , -1 ), ' N' ))
12391239endfunc
12401240
1241+ " -------------------------------------------------------------------------------
1242+ " Test 95: lines of :append, :change, :insert {{{1
1243+ " -------------------------------------------------------------------------------
1244+
1245+ function ! DefineFunction (name, body)
1246+ let func = join ([' function! ' . a: name . ' ()' ] + a: body + [' endfunction' ], " \n " )
1247+ exec func
1248+ endfunction
1249+
1250+ func Test_script_lines ()
1251+ " :append
1252+ try
1253+ call DefineFunction (' T_Append' , [
1254+ \ ' append' ,
1255+ \ ' py <<EOS' ,
1256+ \ ' .' ,
1257+ \ ])
1258+ catch
1259+ call assert_false (1 , " Can't define function" )
1260+ endtry
1261+ try
1262+ call DefineFunction (' T_Append' , [
1263+ \ ' append' ,
1264+ \ ' abc' ,
1265+ \ ])
1266+ call assert_false (1 , " Shouldn't be able to define function" )
1267+ catch
1268+ call assert_exception (' Vim(function):E126: Missing :endfunction' )
1269+ endtry
1270+
1271+ " :change
1272+ try
1273+ call DefineFunction (' T_Change' , [
1274+ \ ' change' ,
1275+ \ ' py <<EOS' ,
1276+ \ ' .' ,
1277+ \ ])
1278+ catch
1279+ call assert_false (1 , " Can't define function" )
1280+ endtry
1281+ try
1282+ call DefineFunction (' T_Change' , [
1283+ \ ' change' ,
1284+ \ ' abc' ,
1285+ \ ])
1286+ call assert_false (1 , " Shouldn't be able to define function" )
1287+ catch
1288+ call assert_exception (' Vim(function):E126: Missing :endfunction' )
1289+ endtry
1290+
1291+ " :insert
1292+ try
1293+ call DefineFunction (' T_Insert' , [
1294+ \ ' insert' ,
1295+ \ ' py <<EOS' ,
1296+ \ ' .' ,
1297+ \ ])
1298+ catch
1299+ call assert_false (1 , " Can't define function" )
1300+ endtry
1301+ try
1302+ call DefineFunction (' T_Insert' , [
1303+ \ ' insert' ,
1304+ \ ' abc' ,
1305+ \ ])
1306+ call assert_false (1 , " Shouldn't be able to define function" )
1307+ catch
1308+ call assert_exception (' Vim(function):E126: Missing :endfunction' )
1309+ endtry
1310+ endfunc
1311+
12411312" -------------------------------------------------------------------------------
12421313" Modelines {{{1
12431314" vim: ts = 8 sw = 4 tw = 80 fdm = marker
0 commit comments