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 19 for name in names { 20 let path = cases.join(&name); 21 let path = path.to_str().unwrap().replace('\\', "/"); 22 module.push_str(&format!( 23 r#" 24#[rustfmt::skip] 25#[test] 26fn {name}() {{ 27 let output = 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}