summaryrefslogtreecommitdiffstats
path: root/test.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test.lua')
-rw-r--r--test.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/test.lua b/test.lua
index 83331a7..32bfb57 100644
--- a/test.lua
+++ b/test.lua
@@ -2,15 +2,25 @@
magic = require("magic")
+
m = magic.open()
-
assert(m:load())
-
print(m:errno())
-print(m:file("Makefile"))
+-- test magic.descriptor() from stdin
+if arg[1] == "--stdin" then
+ -- stdin = 0
+ m:setflags(magic.MIME_ENCODING)
+ print(m:descriptor(0))
+ os.exit(0)
+else
+ os.execute("lua test.lua --stdin < Makefile")
+end
+
+print(m:file("Makefile"))
m:setflags(magic.MIME_TYPE)
print(m:error())
-
print(m:file("Makefile"))
+
+