From bde602d61f16d3f4712b00152c8d74b52fae7170 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Tue, 13 Aug 2024 23:35:24 +0800 Subject: [PATCH] test: fix tests --- dprint_plugin/tests/integration.rs | 6 +++--- markup_fmt/README.md | 6 +++--- markup_fmt/src/lib.rs | 2 +- markup_fmt/tests/fmt.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dprint_plugin/tests/integration.rs b/dprint_plugin/tests/integration.rs index 7195742..9d75c19 100644 --- a/dprint_plugin/tests/integration.rs +++ b/dprint_plugin/tests/integration.rs @@ -32,7 +32,7 @@ fn integration_with_dprint_ts_snapshot() { .map_err(Error::from) } else if ext == "json" { dprint_plugin_json::format_text( - path, + &Path::new("file").with_extension(ext), code, &dprint_plugin_json::configuration::resolve_config( additional_config, @@ -49,7 +49,7 @@ fn integration_with_dprint_ts_snapshot() { }) } else { dprint_plugin_typescript::format_text( - path, + &Path::new("file").with_extension(ext), code.to_owned(), &dprint_plugin_typescript::configuration::resolve_config( additional_config, @@ -120,7 +120,7 @@ fn integration_with_biome_snapshot() { .map_err(Error::from) } else { dprint_plugin_biome::format_text( - path, + &Path::new("file").with_extension(ext), code, &serde_json::to_value(additional_config) .and_then(serde_json::from_value) diff --git a/markup_fmt/README.md b/markup_fmt/README.md index d3a4247..2c4b2d6 100644 --- a/markup_fmt/README.md +++ b/markup_fmt/README.md @@ -12,7 +12,7 @@ assert_eq!("
\n", &format_text( "
", Language::Html, &options, - |_, code, _| Ok::<_, std::convert::Infallible>(code.into()), + |code, _| Ok::<_, std::convert::Infallible>(code.into()), ).unwrap()); ``` @@ -30,7 +30,7 @@ assert!(matches!( "
", Language::Html, &options, - |_, code, _| Ok::<_, std::convert::Infallible>(code.into()), + |code, _| Ok::<_, std::convert::Infallible>(code.into()), ).unwrap_err(), FormatError::Syntax(SyntaxError { .. }) )); @@ -50,7 +50,7 @@ assert!(matches!( "", Language::Html, &options, - |_, _, _| Err(ExternalFormatterError), + |_, _| Err(ExternalFormatterError), ).unwrap_err(), FormatError::External(errors) if !errors.is_empty() )); diff --git a/markup_fmt/src/lib.rs b/markup_fmt/src/lib.rs index 4a17a94..c455d11 100644 --- a/markup_fmt/src/lib.rs +++ b/markup_fmt/src/lib.rs @@ -37,7 +37,7 @@ use tiny_pretty::{IndentKind, PrintOptions}; /// code, /// Language::Html, /// &Default::default(), -/// |_, code, _| Ok::<_, std::convert::Infallible>(code.into()), +/// |code, _| Ok::<_, std::convert::Infallible>(code.into()), /// ).unwrap(); /// ``` /// diff --git a/markup_fmt/tests/fmt.rs b/markup_fmt/tests/fmt.rs index 2cf7770..49a0ea8 100644 --- a/markup_fmt/tests/fmt.rs +++ b/markup_fmt/tests/fmt.rs @@ -38,12 +38,12 @@ fn run_format_test( options: &FormatOptions, language: Language, ) -> String { - let output = format_text(&input, language.clone(), &options, |_, code, _| { + let output = format_text(&input, language.clone(), &options, |code, _| { Ok::<_, ()>(code.into()) }) .map_err(|err| format!("failed to format '{}': {:?}", path.display(), err)) .unwrap(); - let regression_format = format_text(&output, language, &options, |_, code, _| { + let regression_format = format_text(&output, language, &options, |code, _| { Ok::<_, ()>(code.into()) }) .map_err(|err| {