Rename trimLeft to trimStart and trimRight to trimEnd

This commit is contained in:
Hannes 2023-05-22 10:21:08 +08:00
parent d10d71cdec
commit 97fa6758d0
16 changed files with 110 additions and 110 deletions

View file

@ -171,8 +171,8 @@ comptime {
exportStrFn(str.fromUtf8RangeC, "from_utf8_range");
exportStrFn(str.repeat, "repeat");
exportStrFn(str.strTrim, "trim");
exportStrFn(str.strTrimLeft, "trim_left");
exportStrFn(str.strTrimRight, "trim_right");
exportStrFn(str.strTrimStart, "trim_start");
exportStrFn(str.strTrimEnd, "trim_end");
exportStrFn(str.strCloneTo, "clone_to");
exportStrFn(str.withCapacity, "with_capacity");
exportStrFn(str.strGraphemes, "graphemes");

View file

@ -2302,7 +2302,7 @@ pub fn strTrim(input_string: RocStr) callconv(.C) RocStr {
}
}
pub fn strTrimLeft(input_string: RocStr) callconv(.C) RocStr {
pub fn strTrimStart(input_string: RocStr) callconv(.C) RocStr {
var string = input_string;
if (string.isEmpty()) {
@ -2350,7 +2350,7 @@ pub fn strTrimLeft(input_string: RocStr) callconv(.C) RocStr {
}
}
pub fn strTrimRight(input_string: RocStr) callconv(.C) RocStr {
pub fn strTrimEnd(input_string: RocStr) callconv(.C) RocStr {
var string = input_string;
if (string.isEmpty()) {
@ -2583,22 +2583,22 @@ test "strTrim: small to small" {
try expect(trimmed.isSmallStr());
}
test "strTrimLeft: empty" {
const trimmedEmpty = strTrimLeft(RocStr.empty());
test "strTrimStart: empty" {
const trimmedEmpty = strTrimStart(RocStr.empty());
try expect(trimmedEmpty.eq(RocStr.empty()));
}
test "strTrimLeft: blank" {
test "strTrimStart: blank" {
const original_bytes = " ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
const trimmed = strTrimLeft(original);
const trimmed = strTrimStart(original);
try expect(trimmed.eq(RocStr.empty()));
}
test "strTrimLeft: large to large" {
test "strTrimStart: large to large" {
const original_bytes = " hello even more giant world ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
@ -2611,12 +2611,12 @@ test "strTrimLeft: large to large" {
try expect(!expected.isSmallStr());
const trimmed = strTrimLeft(original);
const trimmed = strTrimStart(original);
try expect(trimmed.eq(expected));
}
test "strTrimLeft: large to small" {
test "strTrimStart: large to small" {
// `original` will be consumed by the concat; do not free explicitly
const original_bytes = " hello ";
const original = RocStr.init(original_bytes, original_bytes.len);
@ -2629,14 +2629,14 @@ test "strTrimLeft: large to small" {
try expect(expected.isSmallStr());
const trimmed = strTrimLeft(original);
const trimmed = strTrimStart(original);
defer trimmed.decref();
try expect(trimmed.eq(expected));
try expect(!trimmed.isSmallStr());
}
test "strTrimLeft: small to small" {
test "strTrimStart: small to small" {
const original_bytes = " hello ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
@ -2649,28 +2649,28 @@ test "strTrimLeft: small to small" {
try expect(expected.isSmallStr());
const trimmed = strTrimLeft(original);
const trimmed = strTrimStart(original);
try expect(trimmed.eq(expected));
try expect(trimmed.isSmallStr());
}
test "strTrimRight: empty" {
const trimmedEmpty = strTrimRight(RocStr.empty());
test "strTrimEnd: empty" {
const trimmedEmpty = strTrimEnd(RocStr.empty());
try expect(trimmedEmpty.eq(RocStr.empty()));
}
test "strTrimRight: blank" {
test "strTrimEnd: blank" {
const original_bytes = " ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
const trimmed = strTrimRight(original);
const trimmed = strTrimEnd(original);
try expect(trimmed.eq(RocStr.empty()));
}
test "strTrimRight: large to large" {
test "strTrimEnd: large to large" {
const original_bytes = " hello even more giant world ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
@ -2683,12 +2683,12 @@ test "strTrimRight: large to large" {
try expect(!expected.isSmallStr());
const trimmed = strTrimRight(original);
const trimmed = strTrimEnd(original);
try expect(trimmed.eq(expected));
}
test "strTrimRight: large to small" {
test "strTrimEnd: large to small" {
// `original` will be consumed by the concat; do not free explicitly
const original_bytes = " hello ";
const original = RocStr.init(original_bytes, original_bytes.len);
@ -2701,14 +2701,14 @@ test "strTrimRight: large to small" {
try expect(expected.isSmallStr());
const trimmed = strTrimRight(original);
const trimmed = strTrimEnd(original);
defer trimmed.decref();
try expect(trimmed.eq(expected));
try expect(!trimmed.isSmallStr());
}
test "strTrimRight: small to small" {
test "strTrimEnd: small to small" {
const original_bytes = " hello ";
const original = RocStr.init(original_bytes, original_bytes.len);
defer original.decref();
@ -2721,7 +2721,7 @@ test "strTrimRight: small to small" {
try expect(expected.isSmallStr());
const trimmed = strTrimRight(original);
const trimmed = strTrimEnd(original);
try expect(trimmed.eq(expected));
try expect(trimmed.isSmallStr());

View file

@ -103,8 +103,8 @@ interface Str
startsWith,
endsWith,
trim,
trimLeft,
trimRight,
trimStart,
trimEnd,
toDec,
toF64,
toF32,
@ -448,15 +448,15 @@ trim : Str -> Str
## Return the [Str] with all whitespace removed from the beginning.
## ```
## expect Str.trimLeft " Hello \n\n" == "Hello \n\n"
## expect Str.trimStart " Hello \n\n" == "Hello \n\n"
## ```
trimLeft : Str -> Str
trimStart : Str -> Str
## Return the [Str] with all whitespace removed from the end.
## ```
## expect Str.trimRight " Hello \n\n" == " Hello"
## expect Str.trimEnd " Hello \n\n" == " Hello"
## ```
trimRight : Str -> Str
trimEnd : Str -> Str
## Encode a [Str] to a [Dec]. A [Dec] value is a 128-bit decimal
## [fixed-point number](https://en.wikipedia.org/wiki/Fixed-point_arithmetic).

View file

@ -339,8 +339,8 @@ pub const STR_TO_UTF8: &str = "roc_builtins.str.to_utf8";
pub const STR_FROM_UTF8_RANGE: &str = "roc_builtins.str.from_utf8_range";
pub const STR_REPEAT: &str = "roc_builtins.str.repeat";
pub const STR_TRIM: &str = "roc_builtins.str.trim";
pub const STR_TRIM_LEFT: &str = "roc_builtins.str.trim_left";
pub const STR_TRIM_RIGHT: &str = "roc_builtins.str.trim_right";
pub const STR_TRIM_START: &str = "roc_builtins.str.trim_start";
pub const STR_TRIM_END: &str = "roc_builtins.str.trim_end";
pub const STR_GET_UNSAFE: &str = "roc_builtins.str.get_unsafe";
pub const STR_RESERVE: &str = "roc_builtins.str.reserve";
pub const STR_APPEND_SCALAR: &str = "roc_builtins.str.append_scalar";

View file

@ -118,8 +118,8 @@ map_symbol_to_lowlevel_and_arity! {
StrToUtf8; STR_TO_UTF8; 1,
StrRepeat; STR_REPEAT; 2,
StrTrim; STR_TRIM; 1,
StrTrimLeft; STR_TRIM_LEFT; 1,
StrTrimRight; STR_TRIM_RIGHT; 1,
StrTrimStart; STR_TRIM_START; 1,
StrTrimEnd; STR_TRIM_END; 1,
StrToScalars; STR_TO_SCALARS; 1,
StrGetUnsafe; STR_GET_UNSAFE; 2,
StrSubstringUnsafe; STR_SUBSTRING_UNSAFE; 3,

View file

@ -1491,16 +1491,16 @@ trait Backend<'a> {
arg_layouts,
ret_layout,
),
LowLevel::StrTrimLeft => self.build_fn_call(
LowLevel::StrTrimStart => self.build_fn_call(
sym,
bitcode::STR_TRIM_LEFT.to_string(),
bitcode::STR_TRIM_START.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrTrimRight => self.build_fn_call(
LowLevel::StrTrimEnd => self.build_fn_call(
sym,
bitcode::STR_TRIM_RIGHT.to_string(),
bitcode::STR_TRIM_END.to_string(),
args,
arg_layouts,
ret_layout,

View file

@ -617,7 +617,7 @@ pub(crate) fn run_low_level<'a, 'ctx>(
call_str_bitcode_fn(env, &[string], &[], BitcodeReturns::Str, bitcode::STR_TRIM)
}
StrTrimLeft => {
StrTrimStart => {
// Str.trim : Str -> Str
arguments!(string);
@ -626,10 +626,10 @@ pub(crate) fn run_low_level<'a, 'ctx>(
&[string],
&[],
BitcodeReturns::Str,
bitcode::STR_TRIM_LEFT,
bitcode::STR_TRIM_START,
)
}
StrTrimRight => {
StrTrimEnd => {
// Str.trim : Str -> Str
arguments!(string);
@ -638,7 +638,7 @@ pub(crate) fn run_low_level<'a, 'ctx>(
&[string],
&[],
BitcodeReturns::Str,
bitcode::STR_TRIM_RIGHT,
bitcode::STR_TRIM_END,
)
}
StrWithCapacity => {

View file

@ -281,8 +281,8 @@ impl<'a> LowLevelCall<'a> {
backend.code_builder.i32_const(UPDATE_MODE_IMMUTABLE);
backend.call_host_fn_after_loading_args(bitcode::STR_FROM_UTF8_RANGE, 6, false);
}
StrTrimLeft => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_LEFT),
StrTrimRight => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_RIGHT),
StrTrimStart => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_START),
StrTrimEnd => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_END),
StrToUtf8 => self.load_args_and_call_zig(backend, bitcode::STR_TO_UTF8),
StrReserve => self.load_args_and_call_zig(backend, bitcode::STR_RESERVE),
StrReleaseExcessCapacity => {

View file

@ -20,8 +20,8 @@ pub enum LowLevel {
StrRepeat,
StrFromFloat,
StrTrim,
StrTrimLeft,
StrTrimRight,
StrTrimStart,
StrTrimEnd,
StrToNum,
StrToScalars,
StrGetUnsafe,
@ -260,8 +260,8 @@ map_symbol_to_lowlevel! {
StrToUtf8 <= STR_TO_UTF8,
StrRepeat <= STR_REPEAT,
StrTrim <= STR_TRIM,
StrTrimLeft <= STR_TRIM_LEFT,
StrTrimRight <= STR_TRIM_RIGHT,
StrTrimStart <= STR_TRIM_START,
StrTrimEnd <= STR_TRIM_END,
StrToScalars <= STR_TO_SCALARS,
StrGetUnsafe <= STR_GET_UNSAFE,
StrSubstringUnsafe <= STR_SUBSTRING_UNSAFE,

View file

@ -1303,8 +1303,8 @@ define_builtins! {
15 STR_FROM_UTF8_RANGE: "fromUtf8Range"
16 STR_REPEAT: "repeat"
17 STR_TRIM: "trim"
18 STR_TRIM_LEFT: "trimLeft"
19 STR_TRIM_RIGHT: "trimRight"
18 STR_TRIM_START: "trimStart"
19 STR_TRIM_END: "trimEnd"
20 STR_TO_DEC: "toDec"
21 STR_TO_F64: "toF64"
22 STR_TO_F32: "toF32"

View file

@ -962,8 +962,8 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
StrAppendScalar => arena.alloc_slice_copy(&[owned, irrelevant]),
StrGetScalarUnsafe => arena.alloc_slice_copy(&[borrowed, irrelevant]),
StrTrim => arena.alloc_slice_copy(&[owned]),
StrTrimLeft => arena.alloc_slice_copy(&[owned]),
StrTrimRight => arena.alloc_slice_copy(&[owned]),
StrTrimStart => arena.alloc_slice_copy(&[owned]),
StrTrimEnd => arena.alloc_slice_copy(&[owned]),
StrSplit => arena.alloc_slice_copy(&[borrowed, borrowed]),
StrToNum => arena.alloc_slice_copy(&[borrowed]),
ListPrepend => arena.alloc_slice_copy(&[owned, owned]),

View file

@ -1583,8 +1583,8 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
StrAppendScalar => RC::Rc,
StrGetScalarUnsafe => RC::NoRc,
StrTrim => RC::Rc,
StrTrimLeft => RC::Rc,
StrTrimRight => RC::Rc,
StrTrimStart => RC::Rc,
StrTrimEnd => RC::Rc,
StrSplit => RC::NoRc,
StrToNum => RC::NoRc,
ListPrepend => RC::Rc,

View file

@ -3797,11 +3797,11 @@ mod solve_expr {
}
#[test]
fn str_trim_left() {
fn str_trim_start() {
infer_eq_without_problem(
indoc!(
r#"
Str.trimLeft
Str.trimStart
"#
),
"Str -> Str",

View file

@ -1218,15 +1218,15 @@ fn str_trim_small_to_small_shared() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_left_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimLeft " ""#), RocStr::from(""), RocStr);
fn str_trim_start_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimStart " ""#), RocStr::from(""), RocStr);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_left_small_to_small() {
fn str_trim_start_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimLeft " hello world ""#),
indoc!(r#"Str.trimStart " hello world ""#),
RocStr::from("hello world "),
RocStr
);
@ -1234,9 +1234,9 @@ fn str_trim_left_small_to_small() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_left_large_to_large_unique() {
fn str_trim_start_large_to_large_unique() {
assert_evals_to!(
indoc!(r#"Str.trimLeft (Str.concat " " "hello world from a large string ")"#),
indoc!(r#"Str.trimStart (Str.concat " " "hello world from a large string ")"#),
RocStr::from("hello world from a large string "),
RocStr
);
@ -1244,9 +1244,9 @@ fn str_trim_left_large_to_large_unique() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_left_large_to_small_unique() {
fn str_trim_start_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimLeft (Str.concat " " "hello world ")"#),
indoc!(r#"Str.trimStart (Str.concat " " "hello world ")"#),
RocStr::from("hello world "),
RocStr
);
@ -1254,14 +1254,14 @@ fn str_trim_left_large_to_small_unique() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_left_large_to_large_shared() {
fn str_trim_start_large_to_large_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world world "
{ trimmed: Str.trimLeft original, original: original }
{ trimmed: Str.trimStart original, original: original }
"#
),
(
@ -1274,14 +1274,14 @@ fn str_trim_left_large_to_large_shared() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_left_large_to_small_shared() {
fn str_trim_start_large_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world "
{ trimmed: Str.trimLeft original, original: original }
{ trimmed: Str.trimStart original, original: original }
"#
),
(
@ -1294,14 +1294,14 @@ fn str_trim_left_large_to_small_shared() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_left_small_to_small_shared() {
fn str_trim_start_small_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world "
{ trimmed: Str.trimLeft original, original: original }
{ trimmed: Str.trimStart original, original: original }
"#
),
(RocStr::from(" hello world "), RocStr::from("hello world "),),
@ -1311,15 +1311,15 @@ fn str_trim_left_small_to_small_shared() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_right_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimRight " ""#), RocStr::from(""), RocStr);
fn str_trim_end_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimEnd " ""#), RocStr::from(""), RocStr);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_right_small_to_small() {
fn str_trim_end_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimRight " hello world ""#),
indoc!(r#"Str.trimEnd " hello world ""#),
RocStr::from(" hello world"),
RocStr
);
@ -1327,9 +1327,9 @@ fn str_trim_right_small_to_small() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_right_large_to_large_unique() {
fn str_trim_end_large_to_large_unique() {
assert_evals_to!(
indoc!(r#"Str.trimRight (Str.concat " hello world from a large string" " ")"#),
indoc!(r#"Str.trimEnd (Str.concat " hello world from a large string" " ")"#),
RocStr::from(" hello world from a large string"),
RocStr
);
@ -1337,9 +1337,9 @@ fn str_trim_right_large_to_large_unique() {
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_trim_right_large_to_small_unique() {
fn str_trim_end_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimRight (Str.concat " hello world" " ")"#),
indoc!(r#"Str.trimEnd (Str.concat " hello world" " ")"#),
RocStr::from(" hello world"),
RocStr
);
@ -1347,14 +1347,14 @@ fn str_trim_right_large_to_small_unique() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_right_large_to_large_shared() {
fn str_trim_end_large_to_large_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world world "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(
@ -1367,14 +1367,14 @@ fn str_trim_right_large_to_large_shared() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_right_large_to_small_shared() {
fn str_trim_end_large_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(
@ -1387,14 +1387,14 @@ fn str_trim_right_large_to_small_shared() {
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn str_trim_right_small_to_small_shared() {
fn str_trim_end_small_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(RocStr::from(" hello world "), RocStr::from(" hello world"),),

View file

@ -989,78 +989,78 @@ fn str_trim_small_to_small_shared() {
}
#[test]
fn str_trim_left_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimLeft " ""#), RocStr::from(""), RocStr);
fn str_trim_start_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimStart " ""#), RocStr::from(""), RocStr);
}
#[test]
fn str_trim_left_small_to_small() {
fn str_trim_start_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimLeft " hello ""#),
indoc!(r#"Str.trimStart " hello ""#),
RocStr::from("hello "),
RocStr
);
}
#[test]
fn str_trim_left_large_to_large_unique() {
fn str_trim_start_large_to_large_unique() {
assert_evals_to!(
indoc!(r#"Str.trimLeft (Str.concat " " "hello world from a large string ")"#),
indoc!(r#"Str.trimStart (Str.concat " " "hello world from a large string ")"#),
RocStr::from("hello world from a large string "),
RocStr
);
}
#[test]
fn str_trim_left_large_to_small_unique() {
fn str_trim_start_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimLeft (Str.concat " " "hello ")"#),
indoc!(r#"Str.trimStart (Str.concat " " "hello ")"#),
RocStr::from("hello "),
RocStr
);
}
#[test]
fn str_trim_right_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimRight " ""#), RocStr::from(""), RocStr);
fn str_trim_end_small_blank_string() {
assert_evals_to!(indoc!(r#"Str.trimEnd " ""#), RocStr::from(""), RocStr);
}
#[test]
fn str_trim_right_small_to_small() {
fn str_trim_end_small_to_small() {
assert_evals_to!(
indoc!(r#"Str.trimRight " hello ""#),
indoc!(r#"Str.trimEnd " hello ""#),
RocStr::from(" hello"),
RocStr
);
}
#[test]
fn str_trim_right_large_to_large_unique() {
fn str_trim_end_large_to_large_unique() {
assert_evals_to!(
indoc!(r#"Str.trimRight (Str.concat " hello world from a large string" " ")"#),
indoc!(r#"Str.trimEnd (Str.concat " hello world from a large string" " ")"#),
RocStr::from(" hello world from a large string"),
RocStr
);
}
#[test]
fn str_trim_right_large_to_small_unique() {
fn str_trim_end_large_to_small_unique() {
assert_evals_to!(
indoc!(r#"Str.trimRight (Str.concat " hello" " ")"#),
indoc!(r#"Str.trimEnd (Str.concat " hello" " ")"#),
RocStr::from(" hello"),
RocStr
);
}
#[test]
fn str_trim_right_large_to_large_shared() {
fn str_trim_end_large_to_large_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello world world "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(
@ -1072,14 +1072,14 @@ fn str_trim_right_large_to_large_shared() {
}
#[test]
fn str_trim_right_large_to_small_shared() {
fn str_trim_end_large_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(RocStr::from(" hello "), RocStr::from(" hello"),),
@ -1088,14 +1088,14 @@ fn str_trim_right_large_to_small_shared() {
}
#[test]
fn str_trim_right_small_to_small_shared() {
fn str_trim_end_small_to_small_shared() {
assert_evals_to!(
indoc!(
r#"
original : Str
original = " hello "
{ trimmed: Str.trimRight original, original: original }
{ trimmed: Str.trimEnd original, original: original }
"#
),
(RocStr::from(" hello "), RocStr::from(" hello"),),

View file

@ -286,12 +286,12 @@ fn list_concat_empty_list_zero_sized_type() {
}
#[test]
fn str_trim_right_capacity() {
fn str_trim_end_capacity() {
valgrind_test(indoc!(
r#"
(
str = "a" |> Str.reserve 30
out = str |> Str.trimRight
out = str |> Str.trimEnd
if out == "" then "A" else "B"
)
@ -300,12 +300,12 @@ fn str_trim_right_capacity() {
}
#[test]
fn str_trim_left_capacity() {
fn str_trim_start_capacity() {
valgrind_test(indoc!(
r#"
(
str = " a" |> Str.reserve 30
out = str |> Str.trimLeft
out = str |> Str.trimStart
if out == "" then "A" else "B"
)