fixtures.rs

634 B · rust · 20 lines

1#[path = "../tests/common/rows.rs"]2mod rows;34use serde_json::Value;5use std::path::Path;67fn main() {8    let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures");9    std::fs::create_dir_all(&root).unwrap();10    let mut total = 0;11    for module in rows::MODULES {12        let table = rows::rows(module);13        total += table.len();14        let mut text = serde_json::to_string_pretty(&Value::Array(table.clone())).unwrap();15        text.push('\n');16        std::fs::write(root.join(format!("{module}.json")), text).unwrap();17        println!("{module}.json {} rows", table.len());18    }19    println!("{total} rows");20}