summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/test_tests.rs6
-rw-r--r--cli/tests/testdata/test/markdown_with_comment.md36
-rw-r--r--cli/tests/testdata/test/markdown_with_comment.out5
3 files changed, 47 insertions, 0 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 6424dabd0..f3cf9ebd0 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -103,6 +103,12 @@ itest!(markdown_full_block_names {
output: "test/markdown_full_block_names.out",
});
+itest!(markdown_ignore_html_comment {
+ args: "test --doc --allow-all test/markdown_with_comment.md",
+ exit_code: 1,
+ output: "test/markdown_with_comment.out",
+});
+
itest!(text {
args: "test --doc --allow-all test/text.md",
exit_code: 0,
diff --git a/cli/tests/testdata/test/markdown_with_comment.md b/cli/tests/testdata/test/markdown_with_comment.md
new file mode 100644
index 000000000..886e88103
--- /dev/null
+++ b/cli/tests/testdata/test/markdown_with_comment.md
@@ -0,0 +1,36 @@
+# Documentation
+
+The following examples are inside HTML comments and will not trigger the
+type-checker:
+
+<!-- ```ts ignore
+const value: Invalid = "ignored";
+``` -->
+
+<!--
+```ts
+const a: string = 42;
+```
+-->
+
+<!--
+
+This is a comment.
+
+```ts
+const a: string = 42;
+```
+
+Something something more comments.
+
+```typescript
+const a: boolean = "true";
+```
+
+-->
+
+The following example will trigger the type-checker to fail:
+
+```ts
+const a: string = 42;
+```
diff --git a/cli/tests/testdata/test/markdown_with_comment.out b/cli/tests/testdata/test/markdown_with_comment.out
new file mode 100644
index 000000000..b202919d8
--- /dev/null
+++ b/cli/tests/testdata/test/markdown_with_comment.out
@@ -0,0 +1,5 @@
+Check [WILDCARD]/test/markdown_with_comment.md$34-37.ts
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const a: string = 42;
+ ^
+ at [WILDCARD]/test/markdown_with_comment.md$34-37.ts:1:7