Mercurial > vim
comparison src/testdir/test_cd.vim @ 21265:6a4806e326dd v8.2.1183
patch 8.2.1183: assert_fails() checks the last error message
Commit: https://github.com/vim/vim/commit/9b7bf9e98f06ece595fed7a3ff53ecce89797a53
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 11 22:14:59 2020 +0200
patch 8.2.1183: assert_fails() checks the last error message
Problem: assert_fails() checks the last error message.
Solution: Check the first error, it is more relevant. Fix all the tests
that rely on the old behavior.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Jul 2020 22:30:07 +0200 |
parents | d3fa0d29fa9a |
children | 5b0796787cb2 |
comparison
equal
deleted
inserted
replaced
21264:f3bdfe1d9359 | 21265:6a4806e326dd |
---|---|
2 | 2 |
3 source shared.vim | 3 source shared.vim |
4 | 4 |
5 func Test_cd_large_path() | 5 func Test_cd_large_path() |
6 " This used to crash with a heap write overflow. | 6 " This used to crash with a heap write overflow. |
7 call assert_fails('cd ' . repeat('x', 5000), 'E472:') | 7 call assert_fails('cd ' . repeat('x', 5000), 'E344:') |
8 endfunc | 8 endfunc |
9 | 9 |
10 func Test_cd_up_and_down() | 10 func Test_cd_up_and_down() |
11 let path = getcwd() | 11 let path = getcwd() |
12 cd .. | 12 cd .. |
91 call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) | 91 call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) |
92 call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) | 92 call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) |
93 call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) | 93 call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) |
94 | 94 |
95 " Error case | 95 " Error case |
96 call assert_fails("call chdir('dir-abcd')", 'E472:') | 96 call assert_fails("call chdir('dir-abcd')", 'E344:') |
97 silent! let d = chdir("dir_abcd") | 97 silent! let d = chdir("dir_abcd") |
98 call assert_equal("", d) | 98 call assert_equal("", d) |
99 " Should not crash | 99 " Should not crash |
100 call chdir(d) | 100 call chdir(d) |
101 call assert_equal('', chdir([])) | 101 call assert_equal('', chdir([])) |