Mercurial > vim
annotate src/testdir/test_cmdmods.vim @ 30735:09a61a174259 v9.0.0702
patch 9.0.0702: incomplete testing cursor position with 'linebreak' set
Commit: https://github.com/vim/vim/commit/30c0c467d6cc2a7af960ccb9002b50115b0e55cf
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Oct 9 11:44:28 2022 +0100
patch 9.0.0702: incomplete testing cursor position with 'linebreak' set
Problem: Incomplete testing cursor position after change with 'linebreak'
set.
Solution: Add a test and move test cases together. (closes #11313)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Oct 2022 12:45:05 +0200 |
parents | 3564cddda2a5 |
children | 360f286b5869 |
rev | line source |
---|---|
30174
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Test for all comand modifiers in |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 def Test_cmdmods_array() |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 # Get all the command modifiers from ex_cmds.h. |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 var lines = readfile('../ex_cmds.h')->filter((_, l) => l =~ 'ex_wrongmodifier,') |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 var cmds = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', '')) |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 # :hide is both a command and a modifier |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 cmds->extend(['hide']) |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 # Get the entries of cmdmods[] in ex_docmd.c |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 edit ../ex_docmd.c |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 var top = search('^} cmdmods[') + 1 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 var bot = search('^};') - 1 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 lines = getline(top, bot) |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 var mods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', '')) |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 # Check the lists are equal. Convert them to a dict to get a clearer error |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 # message. |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 var cmds_dict = {} |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 for v in cmds |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 cmds_dict[v] = 1 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 endfor |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 var mods_dict = {} |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 for v in mods |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 mods_dict[v] = 1 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 endfor |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 assert_equal(cmds_dict, mods_dict) |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 bwipe! |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 enddef |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 " vim: shiftwidth=2 sts=2 expandtab |
3564cddda2a5
patch 9.0.0423: "for" and "while" not recognized after :vim9cmd and :legacy
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 |