aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/abc.bz2bin0 -> 66 bytes
-rw-r--r--spec/fs_spec.lua16
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/fixtures/abc.bz2 b/spec/fixtures/abc.bz2
new file mode 100644
index 00000000..ee786715
--- /dev/null
+++ b/spec/fixtures/abc.bz2
Binary files differ
diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua
index 66453404..5bec6168 100644
--- a/spec/fs_spec.lua
+++ b/spec/fs_spec.lua
@@ -1293,6 +1293,22 @@ describe("Luarocks fs test #unit", function()
1293 assert.falsy(exists_file("nonexistent")) 1293 assert.falsy(exists_file("nonexistent"))
1294 end) 1294 end)
1295 end) 1295 end)
1296
1297 describe("fs.bunzip2", function()
1298
1299 it("uncompresses a .bz2 file", function()
1300 local input = testing_paths.fixtures_dir .. "/abc.bz2"
1301 local output = os.tmpname()
1302 assert.truthy(fs.bunzip2(input, output))
1303 local fd = io.open(output, "r")
1304 local content = fd:read("*a")
1305 fd:close()
1306 assert.same(300000, #content)
1307 local abc = ("a"):rep(100000)..("b"):rep(100000)..("c"):rep(100000)
1308 assert.same(abc, content)
1309 end)
1310
1311 end)
1296 1312
1297 describe("fs.unzip", function() 1313 describe("fs.unzip", function()
1298 local tmpdir 1314 local tmpdir