/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use tnipv_lint::lints::markdown::HtmlComments; use tnipv_lint::reporters::Text; use tnipv_lint::Linter; #[tokio::test] async fn warn() { let src = r#"--- header: value1 --- hello text after "#; let reports = Linter::>::default() .clear_lints() .deny( "markdown-html-comments", HtmlComments { name: "header", warn_for: vec!["value1"], }, ) .check_slice(None, src) .run() .await .unwrap() .into_inner(); assert_eq!( reports, r#"warning[markdown-html-comments]: HTML comments are only allowed while `header` is one of: `value1` | 6 | text after "#; let reports = Linter::>::default() .clear_lints() .deny( "markdown-html-comments", HtmlComments { name: "header", warn_for: vec!["value1"], }, ) .check_slice(None, src) .run() .await .unwrap() .into_inner(); assert_eq!( reports, r#"error[markdown-html-comments]: HTML comments are not allowed when `header` is `value2` | 6 |