Switched to build.ps1
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

- Batch script had issues reading from cargo toml file
- Issues were revealed in cargo test (awesome!)
- build.bat is now a wrapper for build.ps1
This commit is contained in:
Eric Ratliff
2026-02-22 22:08:33 -06:00
parent 1ede07df81
commit 7e8d7ecce5
5 changed files with 283 additions and 199 deletions

View File

@@ -574,7 +574,9 @@ fn test_sh_scripts_have_toml_section_get() {
#[test]
fn test_bat_scripts_have_section_parser() {
// Batch scripts need section-aware TOML parsing for board profiles
// Windows scripts need section-aware TOML parsing for board profiles.
// build.bat delegates to build.ps1; upload.bat and monitor.bat may
// still use batch-native parsing or their own .ps1 backends.
let tmp = TempDir::new().unwrap();
let ctx = TemplateContext {
project_name: "bat_section".to_string(),
@@ -585,12 +587,33 @@ fn test_bat_scripts_have_section_parser() {
};
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
for bat in &["build.bat", "upload.bat", "monitor.bat"] {
let content = fs::read_to_string(tmp.path().join(bat)).unwrap();
// Check each Windows script OR its PowerShell backend for section parsing
let pairs: &[(&str, &str)] = &[
("build.bat", "build.ps1"),
("upload.bat", "upload.ps1"),
("monitor.bat", "monitor.ps1"),
];
for (bat, ps1) in pairs {
let bat_path = tmp.path().join(bat);
let ps1_path = tmp.path().join(ps1);
let has_parser = if ps1_path.exists() {
// PowerShell backend handles TOML parsing
let content = fs::read_to_string(&ps1_path).unwrap();
content.contains("boards.") || content.contains("currentSection")
} else if bat_path.exists() {
// Batch does its own section parsing
let content = fs::read_to_string(&bat_path).unwrap();
content.contains("BOARD_SECTION") || content.contains("IN_SECTION")
} else {
false
};
assert!(
content.contains("BOARD_SECTION") || content.contains("IN_SECTION"),
"{} should have section parser for board profiles",
bat
has_parser,
"{} (or {}) should have section parser for board profiles",
bat, ps1
);
}
}