diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/integration/test_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/testdata/test/markdown_full_block_names.md | 19 | ||||
-rw-r--r-- | cli/tests/testdata/test/markdown_full_block_names.out | 6 | ||||
-rw-r--r-- | cli/tools/test.rs | 2 |
4 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index b19cba8f4..6424dabd0 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -97,6 +97,12 @@ itest!(markdown_windows { output: "test/markdown_windows.out", }); +itest!(markdown_full_block_names { + args: "test --doc --allow-all test/markdown_full_block_names.md", + exit_code: 1, + output: "test/markdown_full_block_names.out", +}); + itest!(text { args: "test --doc --allow-all test/text.md", exit_code: 0, diff --git a/cli/tests/testdata/test/markdown_full_block_names.md b/cli/tests/testdata/test/markdown_full_block_names.md new file mode 100644 index 000000000..4f9e1ea51 --- /dev/null +++ b/cli/tests/testdata/test/markdown_full_block_names.md @@ -0,0 +1,19 @@ +# Documentation + +The following block should be given a js extension on extraction: + +```javascript +console.log("js"); +``` + +The following example contains the ignore attribute and will be ignored: + +```typescript ignore +const value: Invalid = "ignored"; +``` + +The following example will trigger the type-checker to fail: + +```typescript +const a: string = 42; +``` diff --git a/cli/tests/testdata/test/markdown_full_block_names.out b/cli/tests/testdata/test/markdown_full_block_names.out new file mode 100644 index 000000000..13051112e --- /dev/null +++ b/cli/tests/testdata/test/markdown_full_block_names.out @@ -0,0 +1,6 @@ +Check [WILDCARD]/test/markdown_full_block_names.md$5-8.js +Check [WILDCARD]/test/markdown_full_block_names.md$17-20.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const a: string = 42; + ^ + at [WILDCARD]/test/markdown_full_block_names.md$17-20.ts:1:7 diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 2a43e3813..20d61098b 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -560,10 +560,12 @@ fn extract_files_from_regex_blocks( match attributes.get(0) { Some(&"js") => MediaType::JavaScript, + Some(&"javascript") => MediaType::JavaScript, Some(&"mjs") => MediaType::Mjs, Some(&"cjs") => MediaType::Cjs, Some(&"jsx") => MediaType::Jsx, Some(&"ts") => MediaType::TypeScript, + Some(&"typescript") => MediaType::TypeScript, Some(&"mts") => MediaType::Mts, Some(&"cts") => MediaType::Cts, Some(&"tsx") => MediaType::Tsx, |