test(wasm): more wasm_str tests

This commit is contained in:
rvcas 2021-12-20 17:48:34 -05:00
parent c6eaf3abd3
commit e269fc4345

View file

@ -12,7 +12,7 @@ use crate::helpers::wasm::assert_evals_to;
#[allow(unused_imports)] #[allow(unused_imports)]
use indoc::indoc; use indoc::indoc;
use roc_std::RocStr; use roc_std::{RocList, RocStr};
// #[test] // #[test]
// fn str_split_empty_delimiter() { // fn str_split_empty_delimiter() {
@ -424,24 +424,24 @@ fn str_ends_with() {
assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool); assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool);
} }
// #[test] #[test]
// fn str_count_graphemes_small_str() { fn str_count_graphemes_small_str() {
// assert_evals_to!(r#"Str.countGraphemes "å🤔""#, 2, usize); assert_evals_to!(r#"Str.countGraphemes "å🤔""#, 2, usize);
// } }
// #[test] #[test]
// fn str_count_graphemes_three_js() { fn str_count_graphemes_three_js() {
// assert_evals_to!(r#"Str.countGraphemes "JJJ""#, 3, usize); assert_evals_to!(r#"Str.countGraphemes "JJJ""#, 3, usize);
// } }
// #[test] #[test]
// fn str_count_graphemes_big_str() { fn str_count_graphemes_big_str() {
// assert_evals_to!( assert_evals_to!(
// r#"Str.countGraphemes "6🤔å🤔e¥🤔çppkd🙃1jdal🦯asdfa∆ltråø˚waia8918.,🏅jjc""#, r#"Str.countGraphemes "6🤔å🤔e¥🤔çppkd🙃1jdal🦯asdfa∆ltråø˚waia8918.,🏅jjc""#,
// 45, 45,
// usize usize
// ); );
// } }
#[test] #[test]
fn str_starts_with_same_big_str() { fn str_starts_with_same_big_str() {
@ -736,45 +736,45 @@ fn str_equality() {
// ); // );
// } // }
// #[test] #[test]
// fn str_join_comma_small() { fn str_join_comma_small() {
// assert_evals_to!( assert_evals_to!(
// r#"Str.joinWith ["1", "2"] ", " "#, r#"Str.joinWith ["1", "2"] ", " "#,
// RocStr::from("1, 2"), RocStr::from("1, 2"),
// RocStr RocStr
// ); );
// } }
// #[test] #[test]
// fn str_join_comma_big() { fn str_join_comma_big() {
// assert_evals_to!( assert_evals_to!(
// r#"Str.joinWith ["10000000", "2000000", "30000000"] ", " "#, r#"Str.joinWith ["10000000", "2000000", "30000000"] ", " "#,
// RocStr::from("10000000, 2000000, 30000000"), RocStr::from("10000000, 2000000, 30000000"),
// RocStr RocStr
// ); );
// } }
// #[test] #[test]
// fn str_join_comma_single() { fn str_join_comma_single() {
// assert_evals_to!(r#"Str.joinWith ["1"] ", " "#, RocStr::from("1"), RocStr); assert_evals_to!(r#"Str.joinWith ["1"] ", " "#, RocStr::from("1"), RocStr);
// } }
// #[test] #[test]
// fn str_to_utf8() { fn str_to_utf8() {
// assert_evals_to!( assert_evals_to!(
// r#"Str.toUtf8 "hello""#, r#"Str.toUtf8 "hello""#,
// RocList::from_slice(&[104, 101, 108, 108, 111]), RocList::from_slice(&[104, 101, 108, 108, 111]),
// RocList<u8> RocList<u8>
// ); );
// assert_evals_to!( assert_evals_to!(
// r#"Str.toUtf8 "this is a long string""#, r#"Str.toUtf8 "this is a long string""#,
// RocList::from_slice(&[ RocList::from_slice(&[
// 116, 104, 105, 115, 32, 105, 115, 32, 97, 32, 108, 111, 110, 103, 32, 115, 116, 114, 116, 104, 105, 115, 32, 105, 115, 32, 97, 32, 108, 111, 110, 103, 32, 115, 116, 114,
// 105, 110, 103 105, 110, 103
// ]), ]),
// RocList<u8> RocList<u8>
// ); );
// } }
// #[test] // #[test]
// fn str_from_utf8_range() { // fn str_from_utf8_range() {