Skip to content

Commit d2d841f

Browse files
committed
regression test
1 parent 93650bc commit d2d841f

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

src/resources/filters/quarto-pre/contentsshortcode.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function contents_shortcode_filter()
104104
-- if we have a span, return it wrapped in a div
105105
return pandoc.Div(pandoc.Plain({span}))
106106
end
107-
warn(
107+
quarto.log.warning(
108108
"[Malformed document] Found `contents` shortcode without a corresponding div with id: " .. tostring(data) .. ".\n" ..
109109
"This might happen because the shortcode is used in div context, while the id corresponds to a span.\n" ..
110110
"Removing from document.")
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
format: typst
3+
title: Another section
4+
_quarto:
5+
tests:
6+
typst:
7+
noErrorsOrWarnings: true
8+
---
9+
10+
## A section
11+
12+
Here we define a plot.
13+
14+
::: {.cell execution_count=1}
15+
16+
::: {.cell-output .cell-output-display}
17+
`code`{#a-cell}
18+
:::
19+
:::
20+
21+
22+
23+
Here we use the plot, inside a callout:
24+
25+
26+
::: callout-note
27+
28+
## Note the following plot
29+
30+
{{< contents a-cell >}}
31+
32+
:::
33+
34+

tests/smoke/smoke-all.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ function resolveTestSpecs(
180180
} else if (key === "noErrors") {
181181
checkWarnings = false;
182182
verifyFns.push(noErrors);
183+
} if (key === "noErrorsOrWarnings") {
184+
checkWarnings = false;
185+
verifyFns.push(noErrorsOrWarnings);
183186
} else {
184187
// See if there is a project and grab it's type
185188
const projectPath = findRootTestsProjectDir(input)

tests/verify.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ export const noErrorsOrWarnings: Verify = {
152152
verify: (outputs: ExecuteOutput[]) => {
153153
const isErrorOrWarning = (output: ExecuteOutput) => {
154154
return output.levelName.toLowerCase() === "warn" ||
155-
output.levelName.toLowerCase() === "error";
155+
output.levelName.toLowerCase() === "error" ||
156+
output.msg.startsWith("(W)"); // this is a warning from quarto.log.warning()
156157
};
157158

158159
const errorsOrWarnings = outputs.some(isErrorOrWarning);

0 commit comments

Comments
 (0)