mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Exit with error in minimize tool if there was no problem to minimize
This commit is contained in:
parent
f7baa878f2
commit
a83f44188b
2 changed files with 6 additions and 3 deletions
|
@ -31,5 +31,6 @@ fn main() {
|
|||
};
|
||||
|
||||
let text = std::fs::read_to_string(&args[2]).unwrap();
|
||||
print_minimizations(&text, kind);
|
||||
let found_error = print_minimizations(&text, kind);
|
||||
std::process::exit(if found_error { 0 } else { 1 });
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ use crate::test_helpers::{Input, InputKind};
|
|||
use bumpalo::Bump;
|
||||
use roc_parse::{ast::Malformed, normalize::Normalize};
|
||||
|
||||
pub fn print_minimizations(text: &str, kind: InputKind) {
|
||||
pub fn print_minimizations(text: &str, kind: InputKind) -> bool {
|
||||
let Some(original_error) = round_trip_once_and_extract_error(text, kind) else {
|
||||
eprintln!("No error found");
|
||||
return;
|
||||
return false;
|
||||
};
|
||||
|
||||
eprintln!("Error found: {}", original_error);
|
||||
|
@ -51,6 +51,8 @@ pub fn print_minimizations(text: &str, kind: InputKind) {
|
|||
|
||||
eprintln!("Final result:");
|
||||
println!("{}", s);
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn make_replacements(s: &str, update: &Update) -> Option<String> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue