Use assert_multiline_str_eq in repl_eval tests

This commit is contained in:
Joshua Warner 2021-12-24 16:19:16 -08:00
parent 9a92d51656
commit 5f7bec3ee8
3 changed files with 8 additions and 8 deletions

1
Cargo.lock generated
View File

@ -3349,6 +3349,7 @@ dependencies = [
"roc_region",
"roc_reporting",
"roc_solve",
"roc_test_utils",
"roc_types",
"roc_unify",
"rustyline",

View File

@ -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"

View File

@ -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{}",