implement List.dropAt

This commit is contained in:
Folkert 2023-05-02 23:30:06 +02:00
parent a48618e34a
commit d6885ec17a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 89 additions and 14 deletions

View file

@ -121,7 +121,7 @@ fn bool_list_concat() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn bool_list_literal_repeat() {
assert_evals_to!(
indoc!(
@ -198,7 +198,7 @@ fn list_append_basic() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_take_first() {
assert_evals_to!(
"List.takeFirst [1, 2, 3] 2",
@ -223,7 +223,7 @@ fn list_take_first() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_take_last() {
assert_evals_to!(
"List.takeLast [1, 2, 3] 2",
@ -288,7 +288,7 @@ fn list_sublist() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_map_try_ok() {
assert_evals_to!(
// No transformation
@ -318,7 +318,7 @@ fn list_map_try_ok() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_map_try_err() {
use core::convert::Infallible;
@ -508,7 +508,7 @@ fn list_drop_at() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_intersperse() {
assert_evals_to!(
indoc!(
@ -553,7 +553,7 @@ fn list_drop_at_shared() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_if_empty_list_of_int() {
assert_evals_to!(
indoc!(
@ -570,7 +570,7 @@ fn list_drop_if_empty_list_of_int() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_if_empty_list() {
assert_evals_to!(
indoc!(
@ -587,7 +587,7 @@ fn list_drop_if_empty_list() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_if_always_false_for_non_empty_list() {
assert_evals_to!(
indoc!(
@ -601,7 +601,7 @@ fn list_drop_if_always_false_for_non_empty_list() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_if_always_true_for_non_empty_list() {
assert_evals_to!(
indoc!(
@ -615,7 +615,7 @@ fn list_drop_if_always_true_for_non_empty_list() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_if_geq3() {
assert_evals_to!(
indoc!(
@ -643,7 +643,7 @@ fn list_drop_if_string_eq() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_drop_last() {
assert_evals_to!(
"List.dropLast [1, 2, 3]",
@ -3800,6 +3800,9 @@ mod pattern_match {
#[cfg(feature = "gen-wasm")]
use crate::helpers::wasm::assert_evals_to;
#[cfg(feature = "gen-dev")]
use crate::helpers::dev::assert_evals_to;
use super::RocList;
#[test]