Skip to content

Commit

Permalink
Add mechanism to check jog results
Browse files Browse the repository at this point in the history
Setting the `QUARTO_JOG_CHECK` environment variable will run checks to
identify filters for which the results of `jog` differ from those of
pandoc's `walk`.
  • Loading branch information
tarleb committed Oct 15, 2024
1 parent 9add002 commit 23e32f7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/resources/filters/ast/runemulation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ end

local function run_emulated_filter_chain(doc, filters, afterFilterPass, profiling)
init_trace(doc)
local compare_jog_and_walk = os.getenv 'QUARTO_JOG_CHECK'
for i, v in ipairs(filters) do
local function callback()
if v.flags then
Expand Down Expand Up @@ -80,7 +81,18 @@ local function run_emulated_filter_chain(doc, filters, afterFilterPass, profilin
else
_quarto.ast._current_doc = doc

doc = run_emulated_filter(doc, v.filter, v.force_pandoc_walk)
if compare_jog_and_walk and not v.force_pandoc_walk then
local expected = run_emulated_filter(doc:clone(), v.filter, true)
doc = run_emulated_filter(doc:clone(), v.filter, false)
if doc == expected then
io.stderr:write("[ OK ] " .. v.name .. '\n')
else
io.stderr:write("[FAIL] " .. v.name .. '\n')
doc = expected
end
else
doc = run_emulated_filter(doc, v.filter, v.force_pandoc_walk)
end

ensure_vault(doc)

Expand Down

0 comments on commit 23e32f7

Please sign in to comment.