compression package wip + debugger bugfixes

This commit is contained in:
kepler155c@gmail.com
2020-05-31 23:51:04 -06:00
parent d203510527
commit fb5e69f703
10 changed files with 1011 additions and 7 deletions

30
tests/test-ramfs.lua Normal file
View File

@@ -0,0 +1,30 @@
local ramfs = require('opus.fs.ramfs')
local fs = _G.fs
local str = 'hello'
local node = fs.mount('test.bin', 'ramfs', 'file')
local file = ramfs.open(node, 'test.bin', 'wb')
for i = 1, 5 do
file.write(str:sub(i, i))
end
file.close()
node = fs.getNode('test.bin')
file = ramfs.open(node, 'test.bin', 'r')
local s = file.read(5)
file.close()
assert(s == str)
file = ramfs.open(node, 'test.bin', 'w')
file.write(str)
file.close()
node = fs.getNode('test.bin')
file = ramfs.open(node, 'test.bin', 'rb')
s = file.read(5)
file.close()
assert(s == str)

20
tests/test-tar.lua Normal file
View File

@@ -0,0 +1,20 @@
local tar = require('compress.tar')
local Util = require('opus.util')
local fs = _G.fs
local files = {
'test-ramfs.lua',
'test-tar.lua',
}
fs.mount('packages/tests/test.tar', 'ramfs', 'file')
tar.tar('packages/tests/test.tar', 'packages/tests', files)
fs.mount('packages/tests/untar', 'ramfs', 'directory')
tar.untar('packages/tests/test.tar', 'packages/tests/untar')
local s1 = Util.readFile('packages/tests/test-ramfs.lua', 'r')
local s2 = Util.readFile('packages/tests/untar/test-ramfs.lua', 'r')
assert(s1 == s2)