From 2d1df4714e2736dbde7855ddcd76b4c1de822fa5 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 21:58:02 +1000 Subject: Added a big bunch of example lua scripts for testing the speed of lua compiling. --- .../nat-5.0.3/test/test_lzio_mk2.lua | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua (limited to 'LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua') diff --git a/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua new file mode 100644 index 0000000..30259c8 --- /dev/null +++ b/LuaSL/testLua/yueliang-0.4.1/nat-5.0.3/test/test_lzio_mk2.lua @@ -0,0 +1,53 @@ +--[[-------------------------------------------------------------------- + + test_lzio.lua + Test for lzio.lua + This file is part of Yueliang. + + Copyright (c) 2005-2006 Kein-Hong Man + The COPYRIGHT file describes the conditions + under which this software may be distributed. + + See the ChangeLog for more information. + +----------------------------------------------------------------------]] + +-- manual test for lzio.lua lua-style chunk reader + +local zio_init = require("../lzio_mk2") + +local z +function dump(z) + while true do + local c = z:getc() + io.stdout:write("("..c..")") + if c == "EOZ" then break end + end + io.stdout:write("\n") +end + +-- z = zio_init("@") for a file +-- z = zio_init("") for a string + +-- [[ +z = zio_init("hello, world!") +dump(z) +z = zio_init("line1\nline2\n") +dump(z) +z = zio_init("@test_lzio_mk2.lua") +dump(z) +--]] + +-- test read beyond end of file +-- bug reported by Adam429 +--[[ +z = zio_init("@test_lzio_mk2.lua") +while true do + local c = z:getc() + io.stdout:write("("..c..")") + if c == "EOZ" then break end +end +print(z:getc()) +print(z:getc()) +io.stdout:write("\n") +--]] -- cgit v1.1