diff options
Diffstat (limited to 'test/definition/init.lua')
-rw-r--r-- | test/definition/init.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/definition/init.lua b/test/definition/init.lua new file mode 100644 index 00000000..9ce0b9e7 --- /dev/null +++ b/test/definition/init.lua @@ -0,0 +1,17 @@ +local matcher = require 'matcher' + +local function test(script) + local start = script:find('<!', 1, true) + 2 + local finish = script:find('!>', 1, true) - 1 + local pos = script:find('<?', 1, true) + 2 + local new_script = script:gsub('<[!?]', ' '):gsub('[!?]>', ' ') + + local a, b = matcher.definition(new_script, pos) + assert(a == start) + assert(b == finish) +end + +test [[ +local <!a!> +<?a?> = 1 +]] |