Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: bf422dc3b6
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (26 sloc) 0.88 kB
require 'luarocks.require'
require 'json'
require 'telescope'
require 'haml'
local function get_tests(filename)
local self = debug.getinfo(1).short_src
if self:match("/") then return "./" .. self:gsub("[^/]*%.lua$", "/" .. filename)
elseif self:match("\\") then return self:gsub("[^\\]*%.lua$", "\\" .. filename)
else return filename
end
end
local fh = assert(io.open(get_tests("tests-new.json")))
local input = fh:read '*a'
fh:close()
local contexts = json.decode(input)
describe("LuaHaml", function()
for context, expectations in pairs(contexts) do
describe("When handling " .. context, function()
for name, exp in pairs(expectations) do
it(string.format("should correctly render %s", name), function()
assert_equal(haml.render(exp.haml, exp.config or {}, exp.locals or {}), exp.html)
end)
end
end)
end
end)
Jump to Line
Something went wrong with that request. Please try again.