mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Fixes merge conflict
This commit is contained in:
commit
c00d400d85
54 changed files with 946 additions and 631 deletions
|
@ -423,12 +423,12 @@ fn str_starts_with() {
|
|||
#[test]
|
||||
fn str_starts_with_code_point() {
|
||||
assert_evals_to!(
|
||||
&format!(r#"Str.startsWithCodePoint "foobar" {}"#, 'f' as u32),
|
||||
&format!(r#"Str.startsWithCodePt "foobar" {}"#, 'f' as u32),
|
||||
true,
|
||||
bool
|
||||
);
|
||||
assert_evals_to!(
|
||||
&format!(r#"Str.startsWithCodePoint "zoobar" {}"#, 'f' as u32),
|
||||
&format!(r#"Str.startsWithCodePt "zoobar" {}"#, 'f' as u32),
|
||||
false,
|
||||
bool
|
||||
);
|
||||
|
@ -819,10 +819,10 @@ fn str_from_float() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn str_to_bytes() {
|
||||
assert_evals_to!(r#"Str.toBytes "hello""#, &[104, 101, 108, 108, 111], &[u8]);
|
||||
fn str_to_utf8() {
|
||||
assert_evals_to!(r#"Str.toUtf8 "hello""#, &[104, 101, 108, 108, 111], &[u8]);
|
||||
assert_evals_to!(
|
||||
r#"Str.toBytes "this is a long string""#,
|
||||
r#"Str.toUtf8 "this is a long string""#,
|
||||
&[
|
||||
116, 104, 105, 115, 32, 105, 115, 32, 97, 32, 108, 111, 110, 103, 32, 115, 116, 114,
|
||||
105, 110, 103
|
||||
|
@ -836,7 +836,7 @@ fn str_from_utf8_range() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toBytes "hello"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { count: 5, start: 0 } is
|
||||
Ok utf8String -> utf8String
|
||||
_ -> ""
|
||||
|
@ -852,7 +852,7 @@ fn str_from_utf8_range_slice() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toBytes "hello"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { count: 4, start: 1 } is
|
||||
Ok utf8String -> utf8String
|
||||
_ -> ""
|
||||
|
@ -868,7 +868,7 @@ fn str_from_utf8_range_slice_not_end() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toBytes "hello"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { count: 3, start: 1 } is
|
||||
Ok utf8String -> utf8String
|
||||
_ -> ""
|
||||
|
@ -884,7 +884,7 @@ fn str_from_utf8_range_order_does_not_matter() {
|
|||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toBytes "hello"
|
||||
bytes = Str.toUtf8 "hello"
|
||||
when Str.fromUtf8Range bytes { start: 1, count: 3 } is
|
||||
Ok utf8String -> utf8String
|
||||
_ -> ""
|
||||
|
@ -895,18 +895,18 @@ fn str_from_utf8_range_order_does_not_matter() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn str_from_utf8_range_out_of_bounds() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
bytes = Str.toBytes "hello"
|
||||
when Str.fromUtf8Range bytes { start: 7, count: 3 } is
|
||||
Ok _ -> ""
|
||||
Err OutOfBounds -> "out of bounds"
|
||||
"#
|
||||
),
|
||||
RocStr::from("out of bounds"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
// #[test]
|
||||
// fn str_from_utf8_range_out_of_bounds() {
|
||||
// assert_evals_to!(
|
||||
// indoc!(
|
||||
// r#"
|
||||
// bytes = Str.toUtf8 "hello"
|
||||
// when Str.fromUtf8Range bytes { start: 7, count: 3 } is
|
||||
// Ok _ -> ""
|
||||
// Err OutOfBounds -> "out of bounds"
|
||||
// "#
|
||||
// ),
|
||||
// RocStr::from("out of bounds"),
|
||||
// RocStr
|
||||
// );
|
||||
// }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue