added agent workflow, added back in a structured version of additionalProperties
This commit is contained in:
53
build.rs
53
build.rs
@ -3,6 +3,23 @@ use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
fn to_safe_identifier(name: &str) -> String {
|
||||
let mut safe = String::new();
|
||||
for (i, c) in name.chars().enumerate() {
|
||||
if c.is_uppercase() {
|
||||
if i > 0 {
|
||||
safe.push('_');
|
||||
}
|
||||
safe.push(c.to_ascii_lowercase());
|
||||
} else if c == '-' || c == '.' {
|
||||
safe.push('_');
|
||||
} else {
|
||||
safe.push(c);
|
||||
}
|
||||
}
|
||||
safe
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=tests/fixtures");
|
||||
println!("cargo:rerun-if-changed=Cargo.toml");
|
||||
@ -18,23 +35,6 @@ fn main() {
|
||||
// Write headers
|
||||
writeln!(std_file, "use jspg::util;").unwrap();
|
||||
|
||||
// Helper for snake_case conversion
|
||||
// let _to_snake_case = |s: &str| -> String {
|
||||
// s.chars().fold(String::new(), |mut acc, c| {
|
||||
// if c.is_uppercase() {
|
||||
// if !acc.is_empty() {
|
||||
// acc.push('_');
|
||||
// }
|
||||
// acc.push(c.to_ascii_lowercase());
|
||||
// } else if c == '-' || c == ' ' || c == '.' || c == '/' || c == ':' {
|
||||
// acc.push('_');
|
||||
// } else if c.is_alphanumeric() {
|
||||
// acc.push(c);
|
||||
// }
|
||||
// acc
|
||||
// })
|
||||
// };
|
||||
|
||||
// Walk tests/fixtures directly
|
||||
let fixtures_path = "tests/fixtures";
|
||||
if Path::new(fixtures_path).exists() {
|
||||
@ -51,24 +51,7 @@ fn main() {
|
||||
if let Some(arr) = val.as_array() {
|
||||
for (i, _item) in arr.iter().enumerate() {
|
||||
// Use deterministic names: test_{filename}_{index}
|
||||
// We sanitize the filename to be a valid identifier
|
||||
// Use manual snake_case logic since we don't want to add a build-dependency just yet if not needed,
|
||||
// but `dynamicRef` -> `dynamic_ref` requires parsing.
|
||||
// Let's implement a simple camelToSnake helper.
|
||||
let mut safe_filename = String::new();
|
||||
for (i, c) in file_name.chars().enumerate() {
|
||||
if c.is_uppercase() {
|
||||
if i > 0 {
|
||||
safe_filename.push('_');
|
||||
}
|
||||
safe_filename.push(c.to_ascii_lowercase());
|
||||
} else if c == '-' || c == '.' {
|
||||
safe_filename.push('_');
|
||||
} else {
|
||||
safe_filename.push(c);
|
||||
}
|
||||
}
|
||||
|
||||
let safe_filename = to_safe_identifier(file_name);
|
||||
let fn_name = format!("test_{}_{}", safe_filename, i);
|
||||
|
||||
// Write to src/tests.rs (PG Test)
|
||||
|
||||
Reference in New Issue
Block a user