mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-07 22:55:00 +00:00
Remove run anyway tip (#7782)
This commit is contained in:
parent
f479d6227e
commit
a27feb309a
7 changed files with 8 additions and 43 deletions
|
@ -619,7 +619,7 @@ pub fn test(matches: &ArgMatches, target: Target) -> io::Result<i32> {
|
|||
return handle_loading_problem(problem);
|
||||
}
|
||||
Err(LoadMonomorphizedError::ErrorModule(module)) => {
|
||||
return handle_error_module(module, start_time.elapsed(), path.as_os_str(), false);
|
||||
return handle_error_module(module, start_time.elapsed());
|
||||
}
|
||||
};
|
||||
let problems = report_problems_monomorphized(&mut loaded);
|
||||
|
@ -1133,7 +1133,7 @@ pub fn build(
|
|||
}
|
||||
}
|
||||
Err(BuildFileError::ErrorModule { module, total_time }) => {
|
||||
handle_error_module(module, total_time, path.as_os_str(), true)
|
||||
handle_error_module(module, total_time)
|
||||
}
|
||||
Err(BuildFileError::LoadingProblem(problem)) => handle_loading_problem(problem),
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
source: crates/cli/tests/cli_tests.rs
|
||||
expression: cli_dev_out.normalize_stdout_and_stderr()
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
── TOO MANY ARGS in tests/test-projects/module_params/arity_mismatch.roc ───────
|
||||
|
||||
The get_user function expects 1 argument, but it got 2 instead:
|
||||
|
@ -36,6 +34,4 @@ make partial application explicit.
|
|||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
3 errors and 0 warnings found in <ignored for test> ms.
|
||||
|
||||
You can run <ignored for tests>
|
||||
3 errors and 0 warnings found in <ignored for test> ms
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
source: crates/cli/tests/cli_tests.rs
|
||||
expression: cli_dev_out.normalize_stdout_and_stderr()
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
── TYPE MISMATCH in tests/test-projects/module_params/BadAnn.roc ───────────────
|
||||
|
||||
Something is off with the body of the
|
||||
|
@ -42,6 +40,4 @@ Tip: It looks like it takes too many arguments. I'm seeing 1 extra.
|
|||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
2 errors and 1 warning found in <ignored for test> ms.
|
||||
|
||||
You can run <ignored for tests>
|
||||
2 errors and 1 warning found in <ignored for test> ms
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
source: crates/cli/tests/cli_tests.rs
|
||||
expression: cli_dev_out.normalize_stdout_and_stderr()
|
||||
snapshot_kind: text
|
||||
---
|
||||
|
||||
── TYPE MISMATCH in tests/test-projects/module_params/unexpected_fn.roc ────────
|
||||
|
||||
This argument to this string interpolation has an unexpected type:
|
||||
|
@ -21,6 +19,4 @@ But this string interpolation needs its argument to be:
|
|||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
1 error and 0 warnings found in <ignored for test> ms.
|
||||
|
||||
You can run <ignored for tests>
|
||||
1 error and 0 warnings found in <ignored for test> ms
|
||||
|
|
|
@ -163,14 +163,8 @@ fn normalize_for_tests(original_output: &str) -> String {
|
|||
.replace_all(&part_normalized, filepath_replacement)
|
||||
.into_owned();
|
||||
|
||||
// replace tip "You can run the program anyway ..." with a placeholder
|
||||
let run_anyway_replacement = "<ignored for tests>";
|
||||
part_normalized = RUN_ANYWAY_REGEX
|
||||
.replace_all(&part_normalized, run_anyway_replacement)
|
||||
.into_owned();
|
||||
|
||||
// replace error summary timings
|
||||
let error_summary_replacement = "$1 error and $2 warning found in <ignored for test> ms";
|
||||
let error_summary_replacement = "$1 error$2 and $3 warning$4 found in <ignored for test> ms";
|
||||
ERROR_SUMMARY_REGEX
|
||||
.replace_all(&part_normalized, error_summary_replacement)
|
||||
.into_owned()
|
||||
|
@ -181,9 +175,7 @@ lazy_static! {
|
|||
static ref TIMING_REGEX: Regex = Regex::new(r" in (\d+) ms\.").expect("Invalid regex pattern");
|
||||
static ref FILEPATH_REGEX: Regex =
|
||||
Regex::new(r"\[([^:]+):(\d+)\]").expect("Invalid filepath regex pattern");
|
||||
static ref RUN_ANYWAY_REGEX: Regex =
|
||||
Regex::new(r"the program anyway with\s+.*").expect("Invalid run anyway regex pattern");
|
||||
static ref ERROR_SUMMARY_REGEX: Regex =
|
||||
Regex::new(r"(\d+) error(?:s)? and (\d+) warning(?:s)? found in \d+ ms")
|
||||
Regex::new(r"(\d+) error(s)? and (\d+) warning(s)? found in \d+ ms")
|
||||
.expect("Invalid error summary regex pattern");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ use roc_reporting::{
|
|||
report::{RenderTarget, DEFAULT_PALETTE},
|
||||
};
|
||||
use roc_target::{Architecture, Target};
|
||||
use std::ffi::OsStr;
|
||||
use std::ops::Deref;
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
|
@ -651,8 +650,6 @@ impl<'a> BuildFileError<'a> {
|
|||
pub fn handle_error_module(
|
||||
mut module: roc_load::LoadedModule,
|
||||
total_time: std::time::Duration,
|
||||
filename: &OsStr,
|
||||
print_run_anyway_hint: bool,
|
||||
) -> std::io::Result<i32> {
|
||||
debug_assert!(module.total_problems() > 0);
|
||||
|
||||
|
@ -660,18 +657,6 @@ pub fn handle_error_module(
|
|||
|
||||
problems.print_error_warning_count(total_time);
|
||||
|
||||
if print_run_anyway_hint {
|
||||
// If you're running "main.roc" then you can just do `roc run`
|
||||
// to re-run the program.
|
||||
print!(".\n\nYou can run the program anyway with \x1B[32mroc run");
|
||||
|
||||
if filename != DEFAULT_ROC_FILENAME {
|
||||
print!(" {}", &filename.to_string_lossy());
|
||||
}
|
||||
|
||||
println!("\x1B[39m");
|
||||
}
|
||||
|
||||
Ok(problems.exit_code())
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ pub fn generate(
|
|||
Ok(0)
|
||||
}
|
||||
Err(BuildFileError::ErrorModule { module, total_time }) => {
|
||||
handle_error_module(module, total_time, spec_path.as_os_str(), true)
|
||||
handle_error_module(module, total_time)
|
||||
}
|
||||
Err(BuildFileError::LoadingProblem(problem)) => handle_loading_problem(problem),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue