comparison src/testdir/test_tabpage.vim @ 21459:a422bd80b434 v8.2.1280

patch 8.2.1280: Ex command error cannot contain an argument Commit: https://github.com/vim/vim/commit/8930caaa1a283092aca81fdbc3fcf15c7eadb197 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 23 16:37:03 2020 +0200 patch 8.2.1280: Ex command error cannot contain an argument Problem: Ex command error cannot contain an argument. Solution: Add ex_errmsg() and translate earlier. Use e_trailing_arg where possible.
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 Jul 2020 16:45:03 +0200
parents 6c634e63989c
children cbc570e66d11
comparison
equal deleted inserted replaced
21458:5b12080761da 21459:a422bd80b434
133 call assert_fails('let t = tabpagenr("#")', 'E15:') 133 call assert_fails('let t = tabpagenr("#")', 'E15:')
134 call assert_equal(0, tabpagewinnr(-1)) 134 call assert_equal(0, tabpagewinnr(-1))
135 call assert_fails("99tabmove", 'E16:') 135 call assert_fails("99tabmove", 'E16:')
136 call assert_fails("+99tabmove", 'E16:') 136 call assert_fails("+99tabmove", 'E16:')
137 call assert_fails("-99tabmove", 'E16:') 137 call assert_fails("-99tabmove", 'E16:')
138 call assert_fails("tabmove foo", 'E474:') 138 call assert_fails("tabmove foo", 'E475:')
139 call assert_fails("tabmove 99", 'E474:') 139 call assert_fails("tabmove 99", 'E475:')
140 call assert_fails("tabmove +99", 'E474:') 140 call assert_fails("tabmove +99", 'E475:')
141 call assert_fails("tabmove -99", 'E474:') 141 call assert_fails("tabmove -99", 'E475:')
142 call assert_fails("tabmove -3+", 'E474:') 142 call assert_fails("tabmove -3+", 'E475:')
143 call assert_fails("tabmove $3", 'E474:') 143 call assert_fails("tabmove $3", 'E475:')
144 call assert_fails("%tabonly", 'E16:') 144 call assert_fails("%tabonly", 'E16:')
145 1tabonly! 145 1tabonly!
146 tabmove 1 146 tabmove 1
147 call assert_equal(1, tabpagenr()) 147 call assert_equal(1, tabpagenr())
148 tabnew 148 tabnew
149 call assert_fails("-2tabmove", 'E474:') 149 call assert_fails("-2tabmove", 'E16:')
150 tabonly! 150 tabonly!
151 endfunc 151 endfunc
152 152
153 " Test autocommands 153 " Test autocommands
154 function Test_tabpage_with_autocmd() 154 function Test_tabpage_with_autocmd()
322 call Check_tab_count(2, 'tabnext +', 3) 322 call Check_tab_count(2, 'tabnext +', 3)
323 call Check_tab_count(2, 'tabnext +2', 4) 323 call Check_tab_count(2, 'tabnext +2', 4)
324 call Check_tab_count(4, 'tabnext -', 3) 324 call Check_tab_count(4, 'tabnext -', 3)
325 call Check_tab_count(4, 'tabnext -2', 2) 325 call Check_tab_count(4, 'tabnext -2', 2)
326 call Check_tab_count(3, 'tabnext $', 5) 326 call Check_tab_count(3, 'tabnext $', 5)
327 call assert_fails('tabnext 0', 'E474:') 327 call assert_fails('tabnext 0', 'E475:')
328 call assert_fails('tabnext .', 'E474:') 328 call assert_fails('tabnext .', 'E475:')
329 call assert_fails('tabnext -+', 'E474:') 329 call assert_fails('tabnext -+', 'E475:')
330 call assert_fails('tabnext +2-', 'E474:') 330 call assert_fails('tabnext +2-', 'E475:')
331 call assert_fails('tabnext $3', 'E474:') 331 call assert_fails('tabnext $3', 'E475:')
332 call assert_fails('tabnext 99', 'E474:') 332 call assert_fails('tabnext 99', 'E475:')
333 call assert_fails('tabnext +99', 'E474:') 333 call assert_fails('tabnext +99', 'E475:')
334 call assert_fails('tabnext -99', 'E474:') 334 call assert_fails('tabnext -99', 'E475:')
335 335
336 1tabonly! 336 1tabonly!
337 endfunction 337 endfunction
338 338
339 " Test for [count] of tabprevious 339 " Test for [count] of tabprevious
354 if n == 0 " pre count 354 if n == 0 " pre count
355 let entire_cmd = c . cmd 355 let entire_cmd = c . cmd
356 let err_code = 'E16:' 356 let err_code = 'E16:'
357 else 357 else
358 let entire_cmd = cmd . ' ' . c 358 let entire_cmd = cmd . ' ' . c
359 let err_code = 'E474:' 359 let err_code = 'E475:'
360 endif 360 endif
361 call assert_fails(entire_cmd, err_code) 361 call assert_fails(entire_cmd, err_code)
362 endfor 362 endfor
363 endfor 363 endfor
364 endfor 364 endfor
453 if n == 0 " pre count 453 if n == 0 " pre count
454 let entire_cmd = c . 'tabclose' 454 let entire_cmd = c . 'tabclose'
455 let err_code = 'E16:' 455 let err_code = 'E16:'
456 else 456 else
457 let entire_cmd = 'tabclose ' . c 457 let entire_cmd = 'tabclose ' . c
458 let err_code = 'E474:' 458 let err_code = 'E475:'
459 endif 459 endif
460 call assert_fails(entire_cmd, err_code) 460 call assert_fails(entire_cmd, err_code)
461 call assert_equal(6, tabpagenr('$')) 461 call assert_equal(6, tabpagenr('$'))
462 endfor 462 endfor
463 endfor 463 endfor
464 464
465 call assert_fails('3tabclose', 'E37:') 465 call assert_fails('3tabclose', 'E37:')
466 call assert_fails('tabclose 3', 'E37:') 466 call assert_fails('tabclose 3', 'E37:')
467 call assert_fails('tabclose -+', 'E474:') 467 call assert_fails('tabclose -+', 'E475:')
468 call assert_fails('tabclose +2-', 'E474:') 468 call assert_fails('tabclose +2-', 'E475:')
469 call assert_equal(6, tabpagenr('$')) 469 call assert_equal(6, tabpagenr('$'))
470 470
471 1tabonly! 471 1tabonly!
472 endfunction 472 endfunction
473 473
508 if n == 0 " pre count 508 if n == 0 " pre count
509 let entire_cmd = c . 'tabonly' 509 let entire_cmd = c . 'tabonly'
510 let err_code = 'E16:' 510 let err_code = 'E16:'
511 else 511 else
512 let entire_cmd = 'tabonly ' . c 512 let entire_cmd = 'tabonly ' . c
513 let err_code = 'E474:' 513 let err_code = 'E475:'
514 endif 514 endif
515 call assert_fails(entire_cmd, err_code) 515 call assert_fails(entire_cmd, err_code)
516 call assert_equal(6, tabpagenr('$')) 516 call assert_equal(6, tabpagenr('$'))
517 endfor 517 endfor
518 endfor 518 endfor
519 519
520 " Test for the error behavior (post count only) 520 " Test for the error behavior (post count only)
521 for c in tc 521 for c in tc
522 call s:reconstruct_tabpage_for_test(6) 522 call s:reconstruct_tabpage_for_test(6)
523 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1] 523 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
524 let err_code = 'E474:' 524 let err_code = 'E475:'
525 call assert_fails(entire_cmd, err_code) 525 call assert_fails(entire_cmd, err_code)
526 call assert_equal(6, tabpagenr('$')) 526 call assert_equal(6, tabpagenr('$'))
527 endfor 527 endfor
528 528
529 call assert_fails('tabonly -+', 'E474:') 529 call assert_fails('tabonly -+', 'E475:')
530 call assert_fails('tabonly +2-', 'E474:') 530 call assert_fails('tabonly +2-', 'E475:')
531 call assert_equal(6, tabpagenr('$')) 531 call assert_equal(6, tabpagenr('$'))
532 532
533 1tabonly! 533 1tabonly!
534 new 534 new
535 only! 535 only!