test: Make platform agnostic

This commit is contained in:
Ed Page 2022-09-01 07:15:42 -05:00
parent 6dd7cbfe7b
commit c49aff00be
6 changed files with 31 additions and 9 deletions

View file

@ -11,7 +11,12 @@ fn codegen() {
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {
writeln!(file, "// This file is @generated {}", file!()).unwrap(); writeln!(
file,
"// This file is @generated {}",
file!().replace('\\', "/")
)
.unwrap();
writeln!(file).unwrap(); writeln!(file).unwrap();
let dict = parse_dict(DICT); let dict = parse_dict(DICT);

View file

@ -13,7 +13,12 @@ fn codegen() {
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(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(); writeln!(file).unwrap();
let Words { let Words {

View file

@ -11,7 +11,12 @@ fn codegen() {
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(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, "#![allow(clippy::unreadable_literal)]",).unwrap();
writeln!(file).unwrap(); writeln!(file).unwrap();

View file

@ -25,7 +25,12 @@ static CATEGORIES: [varcon::Category; 4] = [
fn generate_variations<W: std::io::Write>(file: &mut W) { fn generate_variations<W: std::io::Write>(file: &mut W) {
let entries = entries(); let entries = entries();
writeln!(file, "// This file is @generated by {}", file!(),).unwrap(); writeln!(
file,
"// This file is @generated by {}",
file!().replace('\\', "/")
)
.unwrap();
writeln!( writeln!(
file, file,
"#![allow(clippy::unreadable_literal, clippy::type_complexity)]", "#![allow(clippy::unreadable_literal, clippy::type_complexity)]",

View file

@ -7,10 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::Assert::new() snapbox::assert_eq_path("./src/codegen.rs", content);
.normalize_paths(false)
.action_env(snapbox::DEFAULT_ACTION_ENV)
.eq_path("./src/codegen.rs", content);
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -11,7 +11,12 @@ fn codegen() {
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(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(); writeln!(file).unwrap();
let dict = parse_dict(DICT); let dict = parse_dict(DICT);