Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

1use std::path::PathBuf; 2 3pub fn main() { 4 println!("cargo:rerun-if-changed=cases"); 5 6 let mut module = "//! This file is generated by build.rs 7//! Do not edit it directly, instead add new test cases to ./cases 8" 9 .to_string(); 10 11 let cases = PathBuf::from("./cases"); 12 13 let mut names: Vec<_> = std::fs::read_dir(&cases) 14 .unwrap() 15 .map(|entry| entry.unwrap().file_name().into_string().unwrap()) 16 .collect(); 17 names.sort(); 18 for name in names.into_iter() { 19 let path = cases.join(&name); 20 let path = path.to_str().unwrap().replace('\\', "/"); 21 module.push_str(&format!( 22 r#" 23#[rustfmt::skip] 24#[test] 25fn {name}() {{ 26 let output = 27 crate::prepare("{path}"); 28 insta::assert_snapshot!( 29 "{name}", 30 output, 31 "{path}" 32 ); 33}} 34"# 35 )); 36 } 37 38 let out = PathBuf::from("./src/generated_tests.rs"); 39 std::fs::write(out, module).unwrap(); 40}