annotate src/testdir/test85.in @ 12225:fc791b69be77

Added tag v8.0.0992 for changeset bccf3de747249564fee1e2b1aca090391d5e5da7
author Christian Brabandt <cb@256bit.org>
date Thu, 24 Aug 2017 00:00:05 +0200
parents ae45d497868f
children
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
11091
ae45d497868f patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents: 4293
diff changeset
5 :set belloff=all
3452
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 :so lua.vim
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 :set nocompatible viminfo+=nviminfo
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 :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
9 :lua h = vim.dict(); h.list = l
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 :call garbagecollect()
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 /^1
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 :" change buffer contents
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 :lua curbuf = vim.buffer()
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 :lua curline = vim.eval"line('.')"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 :lua curbuf[curline] = "1 changed line 1"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 :" scalar test
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 :let tmp_string = luaeval('"string"')
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 :let tmp_1000 = luaeval('1000')
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 :if printf("%s%.0f", tmp_string, tmp_1000) == "string1000"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 :let scalar_res = "OK"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 :else
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 :let scalar_res = "FAILED"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 :endif
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 :call append(search("^1"), "scalar test " . scalar_res)
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 :" dictionary containing a list
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 :let tmp = luaeval("h").list[1]
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 :/^2/put =tmp
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 :" 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
29 :lua l[2] = l
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 :let l2 = luaeval("h").list
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 :if l2[2] == l2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 :let res = "OK"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 :else
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 :let res = "FAILED"
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 :endif
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 :call setline(search("^3"), "circular test " . res)
4293
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
37
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
38 :let l = []
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
39 :lua l = vim.eval("l")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
40 :lua l:add(123)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
41 :lua l:add("abc")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
42 :lua l:add(vim.eval("[1, 2, 3]"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
43 :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
44 :lua l:insert(123)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
45 :lua l:insert("abc")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
46 :lua l:insert(vim.eval("[1, 2, 3]"))
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
47 :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
48 :lua l[0] = l[0]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
49 :lua l[1] = l[1]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
50 :lua l[2] = l[2]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
51 :lua l[3] = l[3]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
52 :lua l[0] = 123
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
53 :lua l[1] = "abc"
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
54 :lua l[2] = vim.eval("[1, 2, 3]")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
55 :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
56 :lua l[3] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
57 :lua l[2] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
58 :lua l[1] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
59 :lua l[0] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
60 :lua l = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
61 :$put =string(l)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
62
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
63 :let d = {}
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
64 :lua d = vim.eval("d")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
65 :lua d[0] = 123
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
66 :lua d[1] = "abc"
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
67 :lua d[2] = vim.eval("[1, 2, 3]")
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
68 :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
69 :lua d[4] = d[0]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
70 :lua d[5] = d[1]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
71 :lua d[6] = d[2]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
72 :lua d[7] = d[3]
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
73 :lua d[3] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
74 :lua d[2] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
75 :lua d[1] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
76 :lua d[0] = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
77 :lua d = nil
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
78 :$put =string(d)
af3a3680fc75 updated for version 7.3.896
Bram Moolenaar <bram@vim.org>
parents: 3452
diff changeset
79
3452
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 :?^1?,$w! test.out
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 :qa!
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 ENDTEST
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 1 line 1
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 2 line 2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 3 line 3