Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

chore: move test logic for rgb into function_with_ignorable_args

Donny Kima8752d0d1820
diff --git a/harper-typst/src/typst_translator.rs b/harper-typst/src/typst_translator.rs
index 8bc81dd57..65383fe8b 100644
--- a/harper-typst/src/typst_translator.rs
+++ b/harper-typst/src/typst_translator.rs
@@ -224,7 +224,7 @@ impl<'a> TypstTranslator<'a> {
merge![
token!(func.callee(), TokenKind::Unlintable),
match get_text!(func.callee()) {
- "color.rgb" | "rgb" => parse_args_without(true, &[]),
+ "std.rgb" | "color.rgb" | "rgb" => parse_args_without(true, &[]),
"std.plugin" | "plugin" => parse_args_without(true, &[]),
"std.bibliography" | "bibliography" => parse_args_without(true, &["style"]),
"std.cite" | "cite" => parse_args_without(true, &["style"]),
diff --git a/harper-typst/tests/run_tests.rs b/harper-typst/tests/run_tests.rs
index e46c45dc0..f741f382e 100644
--- a/harper-typst/tests/run_tests.rs
+++ b/harper-typst/tests/run_tests.rs
@@ -38,4 +38,4 @@ create_test!(complex_document.typ, 0);
create_test!(simplified_document.typ, 0);
create_test!(complex_document_with_spelling_mistakes.typ, 4);
// create_test!(issue_399.typ, 3);
-create_test!(function_with_path.typ, 8);
+create_test!(function_with_ignorable_args.typ, 8);
diff --git a/harper-typst/tests/test_sources/function_with_path.typ b/harper-typst/tests/test_sources/function_with_ignorable_args.typ
similarity index 89%
rename from harper-typst/tests/test_sources/function_with_path.typ
rename to harper-typst/tests/test_sources/function_with_ignorable_args.typ
index 99cb9bdfb..233381832 100644
--- a/harper-typst/tests/test_sources/function_with_path.typ
+++ b/harper-typst/tests/test_sources/function_with_ignorable_args.typ
@@ -1,8 +1,11 @@
+#rgb("ffffff")
#plugin("../a.wasm")
#bibliography(("../a.bib", "../b.bib"), style: "../c.csl", title: [Errorz])
#cite(style: "../a.csl", supplement: [Errorz])
#raw(syntaxes: ("../a", "../b"), theme: "../c", [Errorz])
#image("../a", caption: [Errorz])
+#std.rgb("ffffff")
+#color.rgb("ffffff")
#std.plugin("../a.wasm")
#std.bibliography(("../a.bib", "../b.bib"), style: "../c.csl", title: [Errorz])
#std.cite(style: "../a.csl", supplement: [Errorz])
diff --git a/harper-typst/tests/tests.rs b/harper-typst/tests/tests.rs
index bf15bb94a..762142dec 100644
--- a/harper-typst/tests/tests.rs
+++ b/harper-typst/tests/tests.rs
@@ -334,17 +334,3 @@ fn parbreaks_in_list() {
]
))
}
-
-#[test]
-fn do_not_lint_rgb() {
- let source = r#"#color.rgb("ffffff")"#;
-
- let document = Document::new_curated(source, &Typst);
- let token_kinds = document.tokens().map(|t| t.kind.clone()).collect_vec();
- dbg!(&token_kinds);
-
- assert!(matches!(
- &token_kinds.as_slice(),
- &[TokenKind::Unlintable, TokenKind::Unlintable]
- ))
-}