Switched to build.ps1
- 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:
@@ -489,7 +489,7 @@ fn test_refresh_freshly_extracted_is_up_to_date() {
|
||||
TemplateManager::extract("basic", reference.path(), &ctx).unwrap();
|
||||
|
||||
let refreshable = vec![
|
||||
"build.sh", "build.bat",
|
||||
"build.sh", "build.bat", "build.ps1",
|
||||
"upload.sh", "upload.bat",
|
||||
"monitor.sh", "monitor.bat",
|
||||
"test.sh", "test.bat",
|
||||
@@ -561,7 +561,7 @@ fn test_refresh_does_not_list_user_files() {
|
||||
];
|
||||
|
||||
let refreshable = vec![
|
||||
"build.sh", "build.bat",
|
||||
"build.sh", "build.bat", "build.ps1",
|
||||
"upload.sh", "upload.bat",
|
||||
"monitor.sh", "monitor.bat",
|
||||
"test.sh", "test.bat",
|
||||
@@ -644,12 +644,14 @@ fn test_scripts_read_default_board() {
|
||||
);
|
||||
}
|
||||
|
||||
for bat in &["build.bat", "upload.bat", "monitor.bat"] {
|
||||
let content = fs::read_to_string(tmp.path().join(bat)).unwrap();
|
||||
// build.bat is now a thin wrapper; build.ps1 has the real logic.
|
||||
// upload.bat and monitor.bat still have batch-native parsing.
|
||||
for script in &["build.ps1", "upload.bat", "monitor.bat"] {
|
||||
let content = fs::read_to_string(tmp.path().join(script)).unwrap();
|
||||
assert!(
|
||||
content.contains("DEFAULT_BOARD"),
|
||||
"{} should read default field into DEFAULT_BOARD",
|
||||
bat
|
||||
content.contains("DEFAULT_BOARD") || content.contains("DefaultBoard") || content.contains("default"),
|
||||
"{} should read default field for board selection",
|
||||
script
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -674,8 +676,9 @@ fn test_scripts_use_compiler_extra_flags_not_build() {
|
||||
};
|
||||
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
|
||||
|
||||
// build.bat is a thin wrapper; check build.ps1 for content
|
||||
let compile_scripts = vec![
|
||||
"build.sh", "build.bat",
|
||||
"build.sh", "build.ps1",
|
||||
"upload.sh", "upload.bat",
|
||||
];
|
||||
|
||||
@@ -743,8 +746,9 @@ fn test_script_errors_show_manual_fix() {
|
||||
};
|
||||
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
|
||||
|
||||
// build.bat is a thin wrapper; check build.ps1 for content
|
||||
let all_scripts = vec![
|
||||
"build.sh", "build.bat",
|
||||
"build.sh", "build.ps1",
|
||||
"upload.sh", "upload.bat",
|
||||
"monitor.sh", "monitor.bat",
|
||||
];
|
||||
@@ -752,7 +756,7 @@ fn test_script_errors_show_manual_fix() {
|
||||
for script in &all_scripts {
|
||||
let content = fs::read_to_string(tmp.path().join(script)).unwrap();
|
||||
assert!(
|
||||
content.contains("default = "),
|
||||
content.contains("default = ") || content.contains("default ="),
|
||||
"{} error messages should show the manual fix (default = \"...\")",
|
||||
script
|
||||
);
|
||||
@@ -773,8 +777,9 @@ fn test_script_errors_mention_arduino_cli() {
|
||||
};
|
||||
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
|
||||
|
||||
// build.bat is a thin wrapper; check build.ps1 for content
|
||||
let all_scripts = vec![
|
||||
"build.sh", "build.bat",
|
||||
"build.sh", "build.ps1",
|
||||
"upload.sh", "upload.bat",
|
||||
"monitor.sh", "monitor.bat",
|
||||
];
|
||||
@@ -803,8 +808,8 @@ fn test_script_errors_mention_toml_section_syntax() {
|
||||
};
|
||||
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
|
||||
|
||||
// build and upload scripts have both no-default and board-not-found errors
|
||||
for script in &["build.sh", "build.bat", "upload.sh", "upload.bat"] {
|
||||
// build.bat is a thin wrapper; check build.ps1 for content
|
||||
for script in &["build.sh", "build.ps1", "upload.sh", "upload.bat"] {
|
||||
let content = fs::read_to_string(tmp.path().join(script)).unwrap();
|
||||
assert!(
|
||||
content.contains("[boards."),
|
||||
@@ -932,11 +937,12 @@ fn test_build_scripts_autodiscover_driver_includes() {
|
||||
};
|
||||
TemplateManager::extract("basic", tmp.path(), &ctx).unwrap();
|
||||
|
||||
// build.bat is a thin wrapper; check build.ps1 for content.
|
||||
// All four compile scripts must auto-discover lib/drivers/*
|
||||
for script in &["build.sh", "upload.sh", "build.bat", "upload.bat"] {
|
||||
for script in &["build.sh", "upload.sh", "build.ps1", "upload.bat"] {
|
||||
let content = fs::read_to_string(tmp.path().join(script)).unwrap();
|
||||
assert!(
|
||||
content.contains("lib/drivers") || content.contains("lib\\drivers"),
|
||||
content.contains("lib/drivers") || content.contains("lib\\drivers") || content.contains("lib\\\\drivers"),
|
||||
"{} must auto-discover lib/drivers/* for library include paths",
|
||||
script
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user