diff options
Diffstat (limited to 'test/mimetest.lua')
-rw-r--r-- | test/mimetest.lua | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/test/mimetest.lua b/test/mimetest.lua index 834d99f..2f6b7a8 100644 --- a/test/mimetest.lua +++ b/test/mimetest.lua | |||
@@ -47,42 +47,6 @@ local function random(handle, io_err) | |||
47 | else return ltn12.source.empty(io_err or "unable to open file") end | 47 | else return ltn12.source.empty(io_err or "unable to open file") end |
48 | end | 48 | end |
49 | 49 | ||
50 | local function format(chunk) | ||
51 | if chunk then | ||
52 | if chunk == "" then return "''" | ||
53 | else return string.len(chunk) end | ||
54 | else return "nil" end | ||
55 | end | ||
56 | |||
57 | local function show(name, input, output) | ||
58 | local sin = format(input) | ||
59 | local sout = format(output) | ||
60 | io.write(name, ": ", sin, " -> ", sout, "\n") | ||
61 | end | ||
62 | |||
63 | local function chunked(length) | ||
64 | local tmp | ||
65 | return function(chunk) | ||
66 | local ret | ||
67 | if chunk and chunk ~= "" then | ||
68 | tmp = chunk | ||
69 | end | ||
70 | ret = string.sub(tmp, 1, length) | ||
71 | tmp = string.sub(tmp, length+1) | ||
72 | if not chunk and ret == "" then ret = nil end | ||
73 | return ret | ||
74 | end | ||
75 | end | ||
76 | |||
77 | --[[ | ||
78 | local function named(f, name) | ||
79 | return function(chunk) | ||
80 | local ret = f(chunk) | ||
81 | show(name, chunk, ret) | ||
82 | return ret | ||
83 | end | ||
84 | end | ||
85 | ]] | ||
86 | 50 | ||
87 | local function named(f) | 51 | local function named(f) |
88 | return f | 52 | return f |