summary refs log tree commit diff stats
path: root/testc.lua
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2019-07-31 00:10:12 -0300
committerSoniEx2 <endermoneymod@gmail.com>2019-07-31 00:10:12 -0300
commit50fefc6d3f292763386322592965f9003f1bcf71 (patch)
tree246f7ac8f40a0b12d852c6ef2ce318671d477380 /testc.lua
parent5aa22fbbb10e0388c5f0616751cd2cc089147627 (diff)
Fix handling of empty files v1.0.0
Diffstat (limited to 'testc.lua')
-rw-r--r--testc.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/testc.lua b/testc.lua
index 8abdcd5..eb864e1 100644
--- a/testc.lua
+++ b/testc.lua
@@ -23,16 +23,19 @@ end
 
 local cratera = require "dirtycratera"
 
--- first test: does it handle lua code properly?
-assert(printr(cratera.load(io.lines("dirtycompiler.lua", "*a")())))()
+-- first test: does it handle empty files properly?
+assert(printr(cratera.load("")))()
+
+-- second test: does it handle lua code properly?
+assert(printr(cratera.load(io.open("dirtycompiler.lua"):read("*a"))))()
 
 print("-----------------------------------------------------------------------------------------------------------------------")
 print(table.concat(collect))
 
 collect = {}
 
--- second test: does it handle cratera tests properly?
-assert(printr(cratera.load(io.lines("tests.cratera", "*a")())))()
+-- third test: does it handle cratera tests properly?
+assert(printr(cratera.load(io.open("tests.cratera"):read("*a"))))()
 
 print("-----------------------------------------------------------------------------------------------------------------------")
 print(table.concat(collect))