annotate src/testdir/test85.in @ 10601:1b09db809d3f v8.0.0190

patch 8.0.0190: finding duplicate tags uses a slow linear search commit https://github.com/vim/vim/commit/810f9c361c83afb36b9f1cdadca2b93f1201d039 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 15 16:52:51 2017 +0100 patch 8.0.0190: finding duplicate tags uses a slow linear search Problem: Detecting duplicate tags uses a slow linear search. Solution: Use a much faster hash table solution. (James McCoy, closes https://github.com/vim/vim/issues/1046) But don't add hi_keylen, it makes hash tables 50% bigger.
author Christian Brabandt <cb@256bit.org>
date Sun, 15 Jan 2017 17:00:04 +0100
parents af3a3680fc75
children ae45d497868f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3452
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 Test for Lua interface and luaeval() function
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 STARTTEST
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 :so small.vim
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5 :so lua.vim
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 :set nocompatible viminfo+=nviminfo
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 :lua l = vim.list():add"item0":add"dictionary with list OK":add"item2"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 :lua h = vim.dict(); h.list = l
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 :call garbagecollect()
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 /^1
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 :" change buffer contents
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 :lua curbuf = vim.buffer()
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 :lua curline = vim.eval"line('.')"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 :lua curbuf[curline] = "1 changed line 1"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 :" scalar test
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 :let tmp_string = luaeval('"string"')
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 :let tmp_1000 = luaeval('1000')
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 :if printf("%s%.0f", tmp_string, tmp_1000) == "string1000"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 :let scalar_res = "OK"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 :else
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 :let scalar_res = "FAILED"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 :endif
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 :call append(search("^1"), "scalar test " . scalar_res)
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 :" dictionary containing a list
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 :let tmp = luaeval("h").list[1]
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 :/^2/put =tmp
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 :" circular list (at the same time test lists containing lists)
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 :lua l[2] = l
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 :let l2 = luaeval("h").list
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 :if l2[2] == l2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 :let res = "OK"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 :else
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 :let res = "FAILED"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 :endif
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 :call setline(search("^3"), "circular test " . res)
4293
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
36
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
37 :let l = []
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
38 :lua l = vim.eval("l")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
39 :lua l:add(123)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
40 :lua l:add("abc")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
41 :lua l:add(vim.eval("[1, 2, 3]"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
42 :lua l:add(vim.eval("{'a':1, 'b':2, 'c':3}"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
43 :lua l:insert(123)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
44 :lua l:insert("abc")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
45 :lua l:insert(vim.eval("[1, 2, 3]"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
46 :lua l:insert(vim.eval("{'a':1, 'b':2, 'c':3}"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
47 :lua l[0] = l[0]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
48 :lua l[1] = l[1]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
49 :lua l[2] = l[2]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
50 :lua l[3] = l[3]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
51 :lua l[0] = 123
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
52 :lua l[1] = "abc"
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
53 :lua l[2] = vim.eval("[1, 2, 3]")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
54 :lua l[3] = vim.eval("{'a':1, 'b':2, 'c':3}")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
55 :lua l[3] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
56 :lua l[2] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
57 :lua l[1] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
58 :lua l[0] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
59 :lua l = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
60 :$put =string(l)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
61
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
62 :let d = {}
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
63 :lua d = vim.eval("d")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
64 :lua d[0] = 123
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
65 :lua d[1] = "abc"
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
66 :lua d[2] = vim.eval("[1, 2, 3]")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
67 :lua d[3] = vim.eval("{'a':1, 'b':2, 'c':3}")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
68 :lua d[4] = d[0]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
69 :lua d[5] = d[1]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
70 :lua d[6] = d[2]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
71 :lua d[7] = d[3]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
72 :lua d[3] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
73 :lua d[2] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
74 :lua d[1] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
75 :lua d[0] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
76 :lua d = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
77 :$put =string(d)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
78
3452
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 :?^1?,$w! test.out
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 :qa!
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 ENDTEST
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 1 line 1
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 2 line 2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 3 line 3