diff options
author | David Walter Seikel | 2012-01-23 21:58:02 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 21:58:02 +1000 |
commit | 2d1df4714e2736dbde7855ddcd76b4c1de822fa5 (patch) | |
tree | c80e4622631c92dbe8dd6375d187702d084c2f2b /LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua | |
parent | Remove the conflict, and the comment. lol (diff) | |
download | SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.zip SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.gz SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.bz2 SledjHamr-2d1df4714e2736dbde7855ddcd76b4c1de822fa5.tar.xz |
Added a big bunch of example lua scripts for testing the speed of lua compiling.
Diffstat (limited to 'LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua')
-rw-r--r-- | LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua b/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua new file mode 100644 index 0000000..cfd3f4b --- /dev/null +++ b/LuaSL/testLua/yueliang-0.4.1/orig-5.0.3/test/test_lzio.lua | |||
@@ -0,0 +1,55 @@ | |||
1 | --[[-------------------------------------------------------------------- | ||
2 | |||
3 | test_lzio.lua | ||
4 | Test for lzio.lua | ||
5 | This file is part of Yueliang. | ||
6 | |||
7 | Copyright (c) 2005 Kein-Hong Man <khman@users.sf.net> | ||
8 | The COPYRIGHT file describes the conditions | ||
9 | under which this software may be distributed. | ||
10 | |||
11 | See the ChangeLog for more information. | ||
12 | |||
13 | ----------------------------------------------------------------------]] | ||
14 | |||
15 | -- manual test for lzio.lua lua-style chunk reader | ||
16 | |||
17 | require("../lzio") | ||
18 | |||
19 | local z | ||
20 | function dump(z) | ||
21 | while true do | ||
22 | local c = luaZ:zgetc(z) | ||
23 | io.stdout:write("("..c..")") | ||
24 | if c == "EOZ" then break end | ||
25 | end | ||
26 | io.stdout:write("\n") | ||
27 | end | ||
28 | |||
29 | -- luaZ:make_getS or luaZ:make_getF creates a chunk reader | ||
30 | -- luaZ:init makes a zio stream | ||
31 | |||
32 | -- [[ | ||
33 | z = luaZ:init(luaZ:make_getS("hello, world!"), nil, "=string") | ||
34 | dump(z) | ||
35 | z = luaZ:init(luaZ:make_getS(", world!"), "hello", "=string") | ||
36 | dump(z) | ||
37 | z = luaZ:init(luaZ:make_getS("line1\nline2\n"), "", "=string") | ||
38 | dump(z) | ||
39 | z = luaZ:init(luaZ:make_getF("test_lzio.lua"), nil, "=string") | ||
40 | dump(z) | ||
41 | --]] | ||
42 | |||
43 | -- test read beyond end of file | ||
44 | -- bug reported by Adam429 | ||
45 | --[[ | ||
46 | z = luaZ:init(luaZ:make_getF("test_lzio.lua"), nil, "=string") | ||
47 | while true do | ||
48 | local c = luaZ:zgetc(z) | ||
49 | io.stdout:write("("..c..")") | ||
50 | if c == "EOZ" then break end | ||
51 | end | ||
52 | print(luaZ:zgetc(z)) | ||
53 | print(luaZ:zgetc(z)) | ||
54 | io.stdout:write("\n") | ||
55 | --]] | ||