diff --git a/crates/cli/tests/cli_tests.rs b/crates/cli/tests/cli_tests.rs index 053a00b4eac..a4c1953e334 100644 --- a/crates/cli/tests/cli_tests.rs +++ b/crates/cli/tests/cli_tests.rs @@ -319,7 +319,7 @@ mod cli_tests { #[test] #[cfg_attr(windows, ignore)] fn roc_check_markdown_docs() { - let cli_build = ExecCli::new( + let cli_check = ExecCli::new( CMD_CHECK, file_from_root("crates/cli/tests/markdown", "form.md"), ); @@ -327,13 +327,13 @@ mod cli_tests { let expected_out = "0 errors and 0 warnings found in <ignored for test> ms.\n\n0 errors and 0 warnings found in <ignored for test> ms.\n\n"; - cli_build.run().assert_clean_stdout(expected_out); + cli_check.run().assert_clean_stdout(expected_out); } #[test] #[cfg_attr(windows, ignore)] fn import_in_expect() { - let cli_build = ExecCli::new( + let cli_test = ExecCli::new( CMD_TEST, file_from_root( "crates/cli/tests/test-projects/module_params", @@ -343,7 +343,23 @@ mod cli_tests { let expected_out = "0 failed and 3 passed in <ignored for test> ms.\n"; - cli_build.run().assert_clean_stdout(expected_out); + cli_test.run().assert_clean_stdout(expected_out); + } + + #[test] + #[cfg_attr(windows, ignore)] + // https://github.com/roc-lang/roc/issues/7461 + fn issue7461() { + let cli_test = ExecCli::new( + CMD_TEST, + file_from_root("crates/cli/tests/test-projects/", "issue7461.roc"), + ); + + let expected_out = "0 failed and 1 passed in <ignored for test> ms.\n"; + + cli_test + .run() + .assert_stdout_and_stderr_ends_with(expected_out); } } diff --git a/crates/cli/tests/test-projects/issue7461.roc b/crates/cli/tests/test-projects/issue7461.roc new file mode 100644 index 00000000000..288e955254a --- /dev/null +++ b/crates/cli/tests/test-projects/issue7461.roc @@ -0,0 +1,65 @@ +module [] + +expect + + _ = + when new_scatter { data : []} is + Ok asdf -> scatter_to_str asdf + Err _ -> crash "" + + 1 == 1 + + +Trace x := { + data : List { x : x}, + orientation : [Vertical], + name : Str, + marker : Marker, +} + implements [Inspect] + +new_scatter : + { + data : List { x : x }, + orientation ? [Vertical], + name ? Str, + } + -> Result (Trace x) _ +new_scatter = \{ data, orientation ? Vertical, name ? ""} -> + Ok + ( + @Trace { + data, + orientation, + name, + marker: new_marker? {}, + } + ) + +# CHANING ANYHTING IN HERE SEEMS TO "FIX" IT +scatter_to_str : Trace x -> Str where x implements Inspect +scatter_to_str = \@Trace inner -> + + # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY?? + data2 = List.walk inner.data ([]) \(xs), { x } -> (List.append xs x) + + # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY?? + orientation_str = if inner.orientation == Vertical then "\"orientation\":\"v\"" else "\"orientation\":\"h\"" + + # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY?? + name_str = if Str.is_empty inner.name then "" else "\"name\":\"$(inner.name)\"" + + # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY?? + marker_str = marker_to_str inner.marker #"testtt" + + "" + + +Marker := {} + implements [Inspect] + +new_marker : {} -> Result Marker _ +new_marker = \{} -> Ok (@Marker {}) + +marker_to_str : Marker -> Str +marker_to_str = \_ -> "" \ No newline at end of file