From 8b57110b76bd4048f2c1b1a38c473e1b9aee9758 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 3 Apr 2024 09:10:34 -0500 Subject: [PATCH] test(cli): Verify block-ignores via regex --- .../tests/cmd/ignore-block.in/_typos.toml | 5 +++++ .../tests/cmd/ignore-block.in/file.ignore | 5 +++++ crates/typos-cli/tests/cmd/ignore-block.toml | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml create mode 100644 crates/typos-cli/tests/cmd/ignore-block.in/file.ignore create mode 100644 crates/typos-cli/tests/cmd/ignore-block.toml diff --git a/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml b/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml new file mode 100644 index 0000000..26f87f5 --- /dev/null +++ b/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml @@ -0,0 +1,5 @@ +[default] +extend-ignore-re = ["#\\s*spellchecker:off\\s*\\n.*\\n\\s*#\\s*spellchecker:on"] + +[default.extend-identifiers] +hello = "goodbye" diff --git a/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore b/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore new file mode 100644 index 0000000..f4ffbfc --- /dev/null +++ b/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore @@ -0,0 +1,5 @@ +hello +# spellchecker:off +hello +# spellchecker:on +hello diff --git a/crates/typos-cli/tests/cmd/ignore-block.toml b/crates/typos-cli/tests/cmd/ignore-block.toml new file mode 100644 index 0000000..402b757 --- /dev/null +++ b/crates/typos-cli/tests/cmd/ignore-block.toml @@ -0,0 +1,18 @@ +bin.name = "typos" +stdin = "--sort" +stdout = """ +error: `hello` should be `goodbye` + --> ./file.ignore:1:1 + | +1 | hello + | ^^^^^ + | +error: `hello` should be `goodbye` + --> ./file.ignore:5:1 + | +5 | hello + | ^^^^^ + | +""" +stderr = "" +status.code = 2