add str traits for split, between, unquote; consolidate tests

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-31 02:13:23 +00:00 committed by strawberry
parent 2db017af37
commit 99ad404ea9
8 changed files with 212 additions and 51 deletions

View file

@ -36,33 +36,6 @@ fn increment_wrap() {
assert_eq!(res, 0);
}
#[test]
fn common_prefix() {
use utils::string;
let input = ["conduwuit", "conduit", "construct"];
let output = string::common_prefix(&input);
assert_eq!(output, "con");
}
#[test]
fn common_prefix_empty() {
use utils::string;
let input = ["abcdefg", "hijklmn", "opqrstu"];
let output = string::common_prefix(&input);
assert_eq!(output, "");
}
#[test]
fn common_prefix_none() {
use utils::string;
let input = [];
let output = string::common_prefix(&input);
assert_eq!(output, "");
}
#[test]
fn checked_add() {
use crate::checked;
@ -134,19 +107,3 @@ async fn mutex_map_contend() {
tokio::try_join!(join_b, join_a).expect("joined");
assert!(map.is_empty(), "Must be empty");
}
#[test]
fn camel_to_snake_case_0() {
use utils::string::camel_to_snake_string;
let res = camel_to_snake_string("CamelToSnakeCase");
assert_eq!(res, "camel_to_snake_case");
}
#[test]
fn camel_to_snake_case_1() {
use utils::string::camel_to_snake_string;
let res = camel_to_snake_string("CAmelTOSnakeCase");
assert_eq!(res, "camel_tosnake_case");
}