comparison src/testdir/test_wordcount.ok @ 7480:a49163681559 v7.4.1042

commit https://github.com/vim/vim/commit/ed767a2073ef150971b0439a58e7ee582af6984e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 3 22:49:16 2016 +0100 patch 7.4.1042 Problem: g-CTRL-G shows the word count, but there is no way to get the word count in a script. Solution: Add the wordcount() function. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Sun, 03 Jan 2016 23:00:04 +0100
parents
children
comparison
equal deleted inserted replaced
7479:cae508519cf6 7480:a49163681559
1 RESULT test:
2 ----
3 Test 1: empty window
4 [[''], {'chars': 0, 'cursor_chars': 0, 'words': 0, 'cursor_words': 0, 'bytes': 0, 'cursor_bytes': 0}]
5 ----
6 Test 2: some words, cursor at start
7 [['', 'one two three'], {'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, 'bytes': 15, 'cursor_bytes': 1}]
8 ----
9 Test 3: some words, cursor at end
10 [['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 14}]
11 ----
12 Test 4: some words, cursor at end, ve=all
13 [['', 'one two three'], {'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 15}]
14 ----
15 Test 5: several lines with words
16 [['', 'one two three', 'one two three', 'one two three'], {'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, 'bytes': 43, 'cursor_bytes': 42}]
17 ----
18 Test 6: one line with BOM set
19 [['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 18, 'cursor_bytes': 14}]
20 ----
21 Test 7: one line with multibyte words
22 [['', 'Äne M¤ne Müh'], {'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, 'bytes': 17, 'cursor_bytes': 16}]
23 ----
24 Test 8: several lines with multibyte words
25 [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, 'bytes': 36, 'cursor_bytes': 35}]
26 ----
27 Test 9: visual mode, complete buffer
28 [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, 'visual_words': 7, 'visual_bytes': 36}]
29 ----
30 Test 10: visual mode (empty)
31 [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, 'visual_words': 0, 'visual_bytes': 1}]
32 ----
33 Test 11: visual mode, single line
34 [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, 'visual_words': 3, 'visual_bytes': 16}]