mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-12 23:50:20 +03:00
Use assert_multiline_str_eq in repl_eval tests
This commit is contained in:
parent
9a92d51656
commit
5f7bec3ee8
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3349,6 +3349,7 @@ dependencies = [
|
||||
"roc_region",
|
||||
"roc_reporting",
|
||||
"roc_solve",
|
||||
"roc_test_utils",
|
||||
"roc_types",
|
||||
"roc_unify",
|
||||
"rustyline",
|
||||
|
@ -83,6 +83,7 @@ wasmer-wasi = { version = "2.0.0", optional = true }
|
||||
wasmer = { version = "2.0.0", default-features = false, features = ["default-cranelift", "default-universal"] }
|
||||
wasmer-wasi = "2.0.0"
|
||||
pretty_assertions = "1.0.0"
|
||||
roc_test_utils = { path = "../test_utils" }
|
||||
indoc = "1.0.3"
|
||||
serial_test = "0.5.1"
|
||||
tempfile = "3.2.0"
|
||||
|
@ -1,20 +1,18 @@
|
||||
#[macro_use]
|
||||
extern crate pretty_assertions;
|
||||
|
||||
#[macro_use]
|
||||
extern crate indoc;
|
||||
|
||||
#[cfg(test)]
|
||||
mod repl_eval {
|
||||
use cli_utils::helpers;
|
||||
use roc_test_utils::assert_multiline_str_eq;
|
||||
|
||||
const ERROR_MESSAGE_START: char = '─';
|
||||
|
||||
fn expect_success(input: &str, expected: &str) {
|
||||
let out = helpers::repl_eval(input);
|
||||
|
||||
assert_eq!(&out.stderr, "");
|
||||
assert_eq!(&out.stdout, expected);
|
||||
assert_multiline_str_eq!("", out.stderr.as_str());
|
||||
assert_multiline_str_eq!(expected, out.stdout.as_str());
|
||||
assert!(out.status.success());
|
||||
}
|
||||
|
||||
@ -25,12 +23,12 @@ mod repl_eval {
|
||||
// so skip till the header of the first error
|
||||
match out.stdout.find(ERROR_MESSAGE_START) {
|
||||
Some(index) => {
|
||||
assert_eq!(&out.stderr, "");
|
||||
assert_eq!(&out.stdout[index..], expected);
|
||||
assert_multiline_str_eq!("", out.stderr.as_str());
|
||||
assert_multiline_str_eq!(expected, &out.stdout[index..]);
|
||||
assert!(out.status.success());
|
||||
}
|
||||
None => {
|
||||
assert_eq!(&out.stderr, "");
|
||||
assert_multiline_str_eq!("", out.stderr.as_str());
|
||||
assert!(out.status.success());
|
||||
panic!(
|
||||
"I expected a failure, but there is no error message in stdout:\n\n{}",
|
||||
|
Loading…
Reference in New Issue
Block a user