From c49aff00bed30d4a759113ef65c1c4bb40e24c33 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 1 Sep 2022 07:15:42 -0500 Subject: [PATCH] test: Make platform agnostic --- crates/codespell-dict/tests/codegen.rs | 7 ++++++- crates/misspell-dict/tests/codegen.rs | 7 ++++++- crates/typos-dict/tests/codegen.rs | 7 ++++++- crates/typos-vars/tests/codegen.rs | 7 ++++++- crates/varcon/tests/codegen.rs | 5 +---- crates/wikipedia-dict/tests/codegen.rs | 7 ++++++- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/crates/codespell-dict/tests/codegen.rs b/crates/codespell-dict/tests/codegen.rs index 3c49003..bfc45a6 100644 --- a/crates/codespell-dict/tests/codegen.rs +++ b/crates/codespell-dict/tests/codegen.rs @@ -11,7 +11,12 @@ fn codegen() { } fn generate(file: &mut W) { - writeln!(file, "// This file is @generated {}", file!()).unwrap(); + writeln!( + file, + "// This file is @generated {}", + file!().replace('\\', "/") + ) + .unwrap(); writeln!(file).unwrap(); let dict = parse_dict(DICT); diff --git a/crates/misspell-dict/tests/codegen.rs b/crates/misspell-dict/tests/codegen.rs index bf57cfd..f8f2bea 100644 --- a/crates/misspell-dict/tests/codegen.rs +++ b/crates/misspell-dict/tests/codegen.rs @@ -13,7 +13,12 @@ fn codegen() { } fn generate(file: &mut W) { - writeln!(file, "// This file is @generated by {}", file!()).unwrap(); + writeln!( + file, + "// This file is @generated by {}", + file!().replace('\\', "/") + ) + .unwrap(); writeln!(file).unwrap(); let Words { diff --git a/crates/typos-dict/tests/codegen.rs b/crates/typos-dict/tests/codegen.rs index e7408db..e7c393a 100644 --- a/crates/typos-dict/tests/codegen.rs +++ b/crates/typos-dict/tests/codegen.rs @@ -11,7 +11,12 @@ fn codegen() { } fn generate(file: &mut W) { - writeln!(file, "// This file is @generated by {}", file!()).unwrap(); + writeln!( + file, + "// This file is @generated by {}", + file!().replace('\\', "/") + ) + .unwrap(); writeln!(file, "#![allow(clippy::unreadable_literal)]",).unwrap(); writeln!(file).unwrap(); diff --git a/crates/typos-vars/tests/codegen.rs b/crates/typos-vars/tests/codegen.rs index 38ada73..4f66906 100644 --- a/crates/typos-vars/tests/codegen.rs +++ b/crates/typos-vars/tests/codegen.rs @@ -25,7 +25,12 @@ static CATEGORIES: [varcon::Category; 4] = [ fn generate_variations(file: &mut W) { let entries = entries(); - writeln!(file, "// This file is @generated by {}", file!(),).unwrap(); + writeln!( + file, + "// This file is @generated by {}", + file!().replace('\\', "/") + ) + .unwrap(); writeln!( file, "#![allow(clippy::unreadable_literal, clippy::type_complexity)]", diff --git a/crates/varcon/tests/codegen.rs b/crates/varcon/tests/codegen.rs index 0faf8e6..ef5590a 100644 --- a/crates/varcon/tests/codegen.rs +++ b/crates/varcon/tests/codegen.rs @@ -7,10 +7,7 @@ fn codegen() { let content = String::from_utf8(content).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap(); - snapbox::Assert::new() - .normalize_paths(false) - .action_env(snapbox::DEFAULT_ACTION_ENV) - .eq_path("./src/codegen.rs", content); + snapbox::assert_eq_path("./src/codegen.rs", content); } fn generate(file: &mut W) { diff --git a/crates/wikipedia-dict/tests/codegen.rs b/crates/wikipedia-dict/tests/codegen.rs index b8a9e23..f1a7fc6 100644 --- a/crates/wikipedia-dict/tests/codegen.rs +++ b/crates/wikipedia-dict/tests/codegen.rs @@ -11,7 +11,12 @@ fn codegen() { } fn generate(file: &mut W) { - writeln!(file, "// This file is @generated by {}", file!()).unwrap(); + writeln!( + file, + "// This file is @generated by {}", + file!().replace('\\', "/") + ) + .unwrap(); writeln!(file).unwrap(); let dict = parse_dict(DICT);