Skip to content

Commit

Permalink
Add RTL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ollien committed Oct 6, 2024
1 parent 0903554 commit 0edcff5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/gleam/string_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ pub fn trim_left_test() {
|> should.equal("hats \n")
}

pub fn trim_left_rtl_test() {
" עברית "
|> string.trim_left
|> should.equal("עברית ")
}

pub fn trim_right_rtl_test() {
" עברית "
|> string.trim_right
|> should.equal(" עברית")
}

pub fn trim_right_test() {
" hats \n"
|> string.trim_right
Expand All @@ -182,12 +194,24 @@ pub fn trim_chars_left_test() {
|> should.equal("hats..,")
}

pub fn trim_chars_left_rtl_test() {
"שמש"
|> string.trim_chars_left("ש")
|> should.equal("מש")
}

pub fn trim_chars_right_test() {
",..hats..,"
|> string.trim_chars_right(",.")
|> should.equal(",..hats")
}

pub fn trim_chars_right_rtl_test() {
"שמש"
|> string.trim_chars_right("ש")
|> should.equal("שמ")
}

// unicode whitespaces
pub fn trim_horizontal_tab_test() {
"hats\u{0009}"
Expand Down

0 comments on commit 0edcff5

Please sign in to comment.