Mercurial > vim
diff src/testdir/test_textprop.vim @ 24252:7422f2f719a3 v8.2.2667
patch 8.2.2667: prop_find() cannot find item matching both id and type
Commit: https://github.com/vim/vim/commit/24f21fdfca294fec25861343f8928f6480da95f4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 27 22:07:29 2021 +0100
patch 8.2.2667: prop_find() cannot find item matching both id and type
Problem: prop_find() cannot find item matching both id and type.
Solution: Add the "both" argument. (Naohiro Ono, closes https://github.com/vim/vim/issues/8019)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Mar 2021 22:15:03 +0100 |
parents | a5478836fcb7 |
children | 4bc0bda6857d |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -245,6 +245,25 @@ func Test_prop_find_smaller_len_than_mat call prop_type_delete('test') endfunc +func Test_prop_find_with_both_option_enabled() + " Initialize + new + call AddPropTypes() + call SetupPropsInFirstLine() + let props = Get_expected_props()->map({_, v -> extend(v, {'lnum': 1})}) + " Test + call assert_fails("call prop_find({'both': 1})", 'E968:') + call assert_fails("call prop_find({'id': 11, 'both': 1})", 'E860:') + call assert_fails("call prop_find({'type': 'three', 'both': 1})", 'E860:') + call assert_equal({}, prop_find({'id': 11, 'type': 'three', 'both': 1})) + call assert_equal({}, prop_find({'id': 130000, 'type': 'one', 'both': 1})) + call assert_equal(props[2], prop_find({'id': 12, 'type': 'two', 'both': 1})) + call assert_equal(props[0], prop_find({'id': 14, 'type': 'whole', 'both': 1})) + " Clean up + call DeletePropTypes() + bwipe! +endfunc + func Test_prop_add() new call AddPropTypes()