mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Copy list values from the correct offset when reporting expects
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
This commit is contained in:
parent
166be98ac8
commit
c4a3a8bd31
2 changed files with 49 additions and 2 deletions
|
@ -339,7 +339,7 @@ mod test {
|
|||
When it failed, these variables had these values:
|
||||
|
||||
a : List (List Str)
|
||||
a = [[""], []]
|
||||
a = [["foo"], []]
|
||||
|
||||
b : List (List Str)
|
||||
b = [["a string so long that it cannot be short", "bar"]]
|
||||
|
@ -847,4 +847,50 @@ mod test {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn big_recursive_tag_copied_back() {
|
||||
run_expect_test(
|
||||
indoc!(
|
||||
r#"
|
||||
interface A exposes [] imports []
|
||||
|
||||
NonEmpty := [
|
||||
First Str U8,
|
||||
Next (List { item: Str, rest: NonEmpty }),
|
||||
]
|
||||
|
||||
expect
|
||||
nonEmpty =
|
||||
a = "abcdefgh"
|
||||
b = @NonEmpty (First "ijkl" 67u8)
|
||||
c = Next [{ item: a, rest: b }]
|
||||
@NonEmpty c
|
||||
|
||||
when nonEmpty is
|
||||
_ -> False
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
This expectation failed:
|
||||
|
||||
8│> expect
|
||||
9│> nonEmpty =
|
||||
10│> a = "abcdefgh"
|
||||
11│> b = @NonEmpty (First "ijkl" 67u8)
|
||||
12│> c = Next [{ item: a, rest: b }]
|
||||
13│> @NonEmpty c
|
||||
14│>
|
||||
15│> when nonEmpty is
|
||||
16│> _ -> False
|
||||
|
||||
When it failed, these variables had these values:
|
||||
|
||||
nonEmpty : NonEmpty
|
||||
nonEmpty = @NonEmpty (Next [{ item: "abcdefgh", rest: @NonEmpty (First "ijkl" 67) }])
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue