~technomancy/antifennel

ecd2169fcad1fa6616fdf6e6a8569f5b866601e5 — Phil Hagelberg 8 months ago 73b4327
Fix the tests again.
2 files changed, 4 insertions(+), 3 deletions(-)

M antifennel.lua
M antifennel_expected.fnl
M antifennel.lua => antifennel.lua +1 -1
@@ 55,6 55,7 @@ local function compile(rdr, filename, comments)
end

if debug and debug.getinfo and debug.getinfo(3) == nil then -- run as a script
   local filename = arg[1] == "-" and "/dev/stdin" or arg[1]
   local comments = false
   for i,a in ipairs(arg) do
      if a == "--comments" then


@@ 62,7 63,6 @@ if debug and debug.getinfo and debug.getinfo(3) == nil then -- run as a script
         comments = true
      end
   end
   local filename = arg[1] == "-" and "/dev/stdin" or arg[1]
   local f = filename and io.open(filename)
   if f then
      f:close()

M antifennel_expected.fnl => antifennel_expected.fnl +3 -2
@@ 58,7 58,8 @@
    (let [;; run as a script
          filename (or (and (= (. arg 1) "-") :/dev/stdin) (. arg 1))]
      (var comments false)
      (each [_ a (ipairs arg)] (when (= a :--comments) (set comments true)))
      (each [i a (ipairs arg)]
        (when (= a :--comments) (table.remove arg i) (set comments true)))
      (local f (and filename (io.open filename)))
      (if f (do
              (f:close)


@@ 66,7 67,7 @@
                                             comments))]
                (print (.. (fnlfmt.fnlfmt code) "\n"))))
          (do
            (print (: "Usage: %s LUA_FILENAME" :format (. arg 0)))
            (print (: "Usage: %s [--comments] LUA_FILENAME" :format (. arg 0)))
            (print "Compiles LUA_FILENAME to Fennel and prints output.")
            (os.exit 1))))
    (fn [str source filename comments]