mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
dev backend: Box.unbox and List.get str
This commit is contained in:
parent
4d1a6b17a8
commit
8df8c19ae2
3 changed files with 87 additions and 16 deletions
|
@ -1869,6 +1869,20 @@ fn first_int_list() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn first_str_list() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.first ["short", "bar"]
|
||||
"#
|
||||
),
|
||||
RocResult::ok(RocStr::from("short")),
|
||||
RocResult<RocStr, ()>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn first_wildcard_empty_list() {
|
||||
|
@ -1981,6 +1995,20 @@ fn get_wildcard_empty_list() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn get_str_list_ok() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.get ["foo", "bar"] 1
|
||||
"#
|
||||
),
|
||||
RocResult::ok(RocStr::from("bar")),
|
||||
RocResult<RocStr, ()>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn get_int_list_ok() {
|
||||
|
|
|
@ -3254,9 +3254,25 @@ fn issue_2322() {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn box_and_unbox_small_string() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
"short"
|
||||
|> Box.box
|
||||
|> Box.unbox
|
||||
"#
|
||||
),
|
||||
RocStr::from("short"),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn box_and_unbox_string() {
|
||||
fn box_and_unbox_big_string() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue