Commit 35bb6cf6 authored by François Perrad's avatar François Perrad
Browse files

fix template with a final literal whose length is 1

parent 415c6a27
Pipeline #434308 passed with stages
in 34 seconds
Revision history for lua-Silva
0.1.8
- fix template with a final literal whose length is 1
0.1.7 Sun Jul 11 12:30:00 2021
- optimize some backtrack (early fail)
- allow fnmatch from lunix
......
......@@ -137,7 +137,7 @@ local function compile (patt)
end
ops[#ops+1] = op
end
if #patt > ip then
if #patt >= ip then
ops[#ops+1] = { '0', unescape(sub(patt, ip)) }
end
return ops
......
......@@ -18,7 +18,7 @@ local function kv_equals (t, k, expected, name)
end
end
plan(270)
plan(274)
local ctor = require 'Silva.template'
......@@ -30,6 +30,14 @@ truthy( sme('/foo/bar'), 'same string' )
falsy( sme('/foo/baz') )
falsy( sme('/foo/bar/baz') )
sme = ctor'/'
truthy( sme('/'), 'same string' )
falsy( sme('/foo') )
sme = ctor''
truthy( sme(''), 'empty string' )
falsy( sme('/foo') )
-- level 1
sme = ctor'/foo/{var}'
capture = sme('/foo/bar')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment