Skip to content

Commit af9dc54

Browse files
committed
Emoji test
1 parent d8996a9 commit af9dc54

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

β€Žsrc/gleam/string.gleam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,12 @@ pub fn append(to first: String, suffix second: String) -> String {
389389
///
390390
@external(erlang, "erlang", "list_to_binary")
391391
pub fn concat(strings: List(String)) -> String {
392-
do_concat(strings, "")
392+
concat_loop(strings, "")
393393
}
394394

395-
fn do_concat(strings: List(String), accumulator: String) -> String {
395+
fn concat_loop(strings: List(String), accumulator: String) -> String {
396396
case strings {
397-
[string, ..strings] -> do_concat(strings, accumulator <> string)
397+
[string, ..strings] -> concat_loop(strings, accumulator <> string)
398398
[] -> accumulator
399399
}
400400
}

β€Žtest/gleam/string_test.gleam

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ pub fn concat_test() {
141141
|> should.equal("Hello, world!")
142142
}
143143

144+
pub fn concat_emoji_test() {
145+
["πŸ’ƒπŸΏ", "πŸ’‡πŸΌβ€β™€οΈ", "πŸ§”β€β™‚οΈ", "πŸ§‘β€πŸ¦Όβ€βž‘οΈ"]
146+
|> string.concat
147+
|> should.equal("πŸ’ƒπŸΏπŸ’‡πŸΌβ€β™€οΈπŸ§”β€β™‚οΈπŸ§‘β€πŸ¦Όβ€βž‘οΈ")
148+
}
149+
144150
pub fn repeat_test() {
145151
"hi"
146152
|> string.repeat(times: 3)

0 commit comments

Comments
Β (0)