annotate src/testdir/test85.in @ 3812:f86619764a1e v7.3.664

updated for version 7.3.664 Problem: Buffer overflow in unescaping text. (Raymond Ko) Solution: Limit check for multi-byte character to 4 bytes.
author Bram Moolenaar <bram@vim.org>
date Tue, 18 Sep 2012 18:03:37 +0200
parents e070b34fe35e
children af3a3680fc75
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)
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 :?^1?,$w! test.out
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 :qa!
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 ENDTEST
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 1 line 1
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 2 line 2
e070b34fe35e updated for version 7.3.491
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 3 line 3