Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
24251:0d7aa9d9bfbd | 24252:7422f2f719a3 |
---|---|
241 call prop_add(1, 4, {'type': 'test'}) | 241 call prop_add(1, 4, {'type': 'test'}) |
242 call assert_equal({'id': 0, 'lnum': 1, 'col': 4, 'type': 'test', 'length': 0, 'start': 1, 'end': 1}, | 242 call assert_equal({'id': 0, 'lnum': 1, 'col': 4, 'type': 'test', 'length': 0, 'start': 1, 'end': 1}, |
243 \ prop_find({'type': 'test', 'lnum': 2, 'col': 1}, 'b')) | 243 \ prop_find({'type': 'test', 'lnum': 2, 'col': 1}, 'b')) |
244 bwipe! | 244 bwipe! |
245 call prop_type_delete('test') | 245 call prop_type_delete('test') |
246 endfunc | |
247 | |
248 func Test_prop_find_with_both_option_enabled() | |
249 " Initialize | |
250 new | |
251 call AddPropTypes() | |
252 call SetupPropsInFirstLine() | |
253 let props = Get_expected_props()->map({_, v -> extend(v, {'lnum': 1})}) | |
254 " Test | |
255 call assert_fails("call prop_find({'both': 1})", 'E968:') | |
256 call assert_fails("call prop_find({'id': 11, 'both': 1})", 'E860:') | |
257 call assert_fails("call prop_find({'type': 'three', 'both': 1})", 'E860:') | |
258 call assert_equal({}, prop_find({'id': 11, 'type': 'three', 'both': 1})) | |
259 call assert_equal({}, prop_find({'id': 130000, 'type': 'one', 'both': 1})) | |
260 call assert_equal(props[2], prop_find({'id': 12, 'type': 'two', 'both': 1})) | |
261 call assert_equal(props[0], prop_find({'id': 14, 'type': 'whole', 'both': 1})) | |
262 " Clean up | |
263 call DeletePropTypes() | |
264 bwipe! | |
246 endfunc | 265 endfunc |
247 | 266 |
248 func Test_prop_add() | 267 func Test_prop_add() |
249 new | 268 new |
250 call AddPropTypes() | 269 call AddPropTypes() |