Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 33594:e9c70470fe94 v9.0.2041
patch 9.0.2041: trim(): hard to use default mask
Commit: https://github.com/vim/vim/commit/8079917447e7436dccc2e4cd4a4a56ae0a4712f2
Author: Illia Bobyr <illia.bobyr@gmail.com>
Date: Tue Oct 17 18:00:50 2023 +0200
patch 9.0.2041: trim(): hard to use default mask
Problem: trim(): hard to use default mask (partly revert v9.0.2040)
Solution: use default mask when it is empty
The default 'mask' value is pretty complex, as it includes many
characters. Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.
Currently, an empty 'mask' will make 'trim()' call return 'text' value
that is passed in unmodified. It is unlikely that someone is using it,
so the chances of scripts being broken by this change are low.
Also, this reverts commit 9.0.2040 (which uses v:none for the default
and requires to use an empty string instead).
closes: #13358
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 17 Oct 2023 18:15:03 +0200 |
parents | 288da62613ba |
children | cd7acb9bc4fd |
comparison
equal
deleted
inserted
replaced
33593:0234f91bc590 | 33594:e9c70470fe94 |
---|---|
4784 assert_fails("tr('ab', '', 'AB')", 'E475:') | 4784 assert_fails("tr('ab', '', 'AB')", 'E475:') |
4785 enddef | 4785 enddef |
4786 | 4786 |
4787 def Test_trim() | 4787 def Test_trim() |
4788 v9.CheckDefAndScriptFailure(['trim(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) | 4788 v9.CheckDefAndScriptFailure(['trim(["a"])'], ['E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1']) |
4789 v9.CheckDefAndScriptFailure(['trim("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1393: String or v:none required for argument 2']) | 4789 v9.CheckDefAndScriptFailure(['trim("a", ["b"])'], ['E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1174: String required for argument 2']) |
4790 v9.CheckDefAndScriptFailure(['trim("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) | 4790 v9.CheckDefAndScriptFailure(['trim("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3']) |
4791 trim('')->assert_equal('') | 4791 trim('')->assert_equal('') |
4792 trim('', '')->assert_equal('') | 4792 trim('', '')->assert_equal('') |
4793 enddef | 4793 enddef |
4794 | 4794 |