diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luazip/tests')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/a/b/c.zip | bin | 0 -> 114 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.ext2 | bin | 0 -> 203 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.zip | bin | 0 -> 203 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/a3.ext3 | bin | 0 -> 299 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/a3.zip | bin | 0 -> 297 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/luazip.zip | bin | 0 -> 5062 bytes | |||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luazip/tests/test_zip.lua | 76 |
7 files changed, 76 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/a/b/c.zip b/Build/source/texk/web2c/luatexdir/luazip/tests/a/b/c.zip Binary files differnew file mode 100644 index 00000000000..6e432b41c56 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/a/b/c.zip diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.ext2 b/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.ext2 Binary files differnew file mode 100644 index 00000000000..cbc96481469 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.ext2 diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.zip b/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.zip Binary files differnew file mode 100644 index 00000000000..4635580d657 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/a2/b2.zip diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/a3.ext3 b/Build/source/texk/web2c/luatexdir/luazip/tests/a3.ext3 Binary files differnew file mode 100644 index 00000000000..f02ba2cf97e --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/a3.ext3 diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/a3.zip b/Build/source/texk/web2c/luatexdir/luazip/tests/a3.zip Binary files differnew file mode 100644 index 00000000000..6f6c291f3d4 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/a3.zip diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/luazip.zip b/Build/source/texk/web2c/luatexdir/luazip/tests/luazip.zip Binary files differnew file mode 100644 index 00000000000..bf498e2a0eb --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/luazip.zip diff --git a/Build/source/texk/web2c/luatexdir/luazip/tests/test_zip.lua b/Build/source/texk/web2c/luatexdir/luazip/tests/test_zip.lua new file mode 100644 index 00000000000..84e2cae4ec0 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luazip/tests/test_zip.lua @@ -0,0 +1,76 @@ +--[[------------------------------------------------------------------------ +test_zip.lua +test code for luazip +--]]------------------------------------------------------------------------ + +-- compatibility code for Lua version 5.0 providing 5.1 behavior +if string.find (_VERSION, "Lua 5.0") and not package then + if not LUA_PATH then + LUA_PATH = os.getenv("LUA_PATH") or "./?.lua;" + end + require"compat-5.1" + package.cpath = os.getenv("LUA_CPATH") or "./?.so;./?.dll;./?.dylib" +end + +require('zip') + +function test_open () + local zfile, err = zip.open('luazip.zip') + + assert(zfile, err) + + print("File list begin") + for file in zfile:files() do + print(file.filename) + end + print("File list ended OK!") + print() + + print("Testing zfile:open") + local f1, err = zfile:open('README') + assert(f1, err) + + local f2, err = zfile:open('luazip.h') + assert(f2, err) + print("zfile:open OK!") + print() + + print("Testing reading by number") + local c = f1:read(1) + while c ~= nil do + io.write(c) + c = f1:read(1) + end + + print() + print("OK") + print() +end + +function test_openfile () + print("Testing the openfile magic") + + local d, err = zip.openfile('a/b/c/d.txt') + assert(d, err) + + local e, err = zip.openfile('a/b/c/e.txt') + assert(e == nil, err) + + local d2, err = zip.openfile('a2/b2/c2/d2.txt', "ext2") + assert(d2, err) + + local e2, err = zip.openfile('a2/b2/c2/e2.txt', "ext2") + assert(e2 == nil, err) + + local d3, err = zip.openfile('a3/b3/c3/d3.txt', {"ext2", "ext3"}) + assert(d3, err) + + local e3, err = zip.openfile('a3/b3/c3/e3.txt', {"ext2", "ext3"}) + assert(e3 == nil, err) + + print("Smooth magic!") + print() +end + +test_open() +test_openfile() |