mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Fix nested string interpolation test
This commit is contained in:
parent
7d491f1bce
commit
a93e0b44fd
2 changed files with 18 additions and 17 deletions
|
@ -3,6 +3,7 @@ use std::io::Write;
|
|||
use std::path::PathBuf;
|
||||
use std::process::{Command, ExitStatus, Stdio};
|
||||
|
||||
use roc_repl_cli::repl_state::TIPS;
|
||||
use roc_repl_cli::{SHORT_INSTRUCTIONS, WELCOME_MESSAGE};
|
||||
use roc_test_utils::assert_multiline_str_eq;
|
||||
|
||||
|
@ -152,7 +153,22 @@ pub fn expect_failure(input: &str, expected: &str) {
|
|||
match out.stdout.find(ERROR_MESSAGE_START) {
|
||||
Some(index) => {
|
||||
assert_multiline_str_eq!("", out.stderr.as_str());
|
||||
assert_multiline_str_eq!(expected, &out.stdout[index..]);
|
||||
|
||||
// For some unknown reason, in the non-wasm tests, if there's a syntax error
|
||||
// (e.g. in the nested string interpolation test), it prints the tips at the end.
|
||||
// This doesn't happen in the actual CLI repl or in the wasm tests.
|
||||
//
|
||||
// Ideally we'd figure out why that's happening and stop it from happening,
|
||||
// but since it only happens in the CLI tests, in the meantime this is an acceptable fix.
|
||||
let tips_index = out
|
||||
.stdout
|
||||
.rfind(std::str::from_utf8(&strip_ansi_escapes::strip(TIPS).unwrap()).unwrap())
|
||||
.unwrap_or(out.stdout.len());
|
||||
|
||||
assert_multiline_str_eq!(
|
||||
expected.trim_end(),
|
||||
out.stdout[index..tips_index].trim_end()
|
||||
);
|
||||
assert!(out.status.success());
|
||||
}
|
||||
None => {
|
||||
|
|
|
@ -1380,22 +1380,7 @@ fn interpolation_with_nested_interpolation() {
|
|||
|
||||
You can learn more about string interpolation at
|
||||
<https://www.roc-lang.org/tutorial#string-interpolation>
|
||||
|
||||
|
||||
Enter an expression to evaluate, or a definition (like x = 1) to use in future expressions.
|
||||
|
||||
Unless there was a compile-time error, expressions get automatically named so you can refer to them later.
|
||||
For example, if you see # val1 after an output, you can now refer to that expression as val1 in future expressions.
|
||||
|
||||
Tips:
|
||||
|
||||
- ctrl-v + ctrl-j makes a newline
|
||||
|
||||
- :q to quit
|
||||
|
||||
- :help"#
|
||||
"#
|
||||
),
|
||||
// TODO figure out why the tests prints the repl help text at the end, but only after syntax errors or something?
|
||||
// In the actual repl this doesn't happen, only in the test.
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue