mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Consistently triggering null pointer bug
This commit is contained in:
parent
945212db28
commit
05d87314e7
2 changed files with 61 additions and 7 deletions
|
@ -896,7 +896,7 @@ fn str_from_utf8_range_order_does_not_matter() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn str_from_utf8_range_out_of_bounds() {
|
||||
fn str_from_utf8_range_out_of_bounds_start_value() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
|
@ -911,3 +911,37 @@ fn str_from_utf8_range_out_of_bounds() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn str_from_utf8_range_count_too_high() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { start: 0, count: 6 } is
|
||||
Ok _ -> ""
|
||||
Err (BadUtf8 _ _) -> ""
|
||||
Err OutOfBounds -> "out of bounds"
|
||||
"#
|
||||
),
|
||||
RocStr::from("out of bounds"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn str_from_utf8_range_count_too_high_for_start() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { start: 4, count: 3 } is
|
||||
Ok _ -> ""
|
||||
Err (BadUtf8 _ _) -> ""
|
||||
Err OutOfBounds -> "out of bounds"
|
||||
"#
|
||||
),
|
||||
RocStr::from("out of bounds"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue