Skip to content
Permalink
Browse files
Merge pull request #1900 from krestenkrab/krab-unicode
In response to "The string type is broken"
  • Loading branch information
josevalim committed Nov 29, 2013
2 parents a829da1 + d95a7d1 commit c093e378d849baceb81b0bc7f373ccc6c8b1c141
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/elixir/test/elixir/string_test.exs
@@ -15,6 +15,19 @@ defmodule StringTest do
assert String.next_codepoint("") == :no_codepoint
end

# test cases described in http://mortoray.com/2013/11/27/the-string-type-is-broken/
test :unicode do
assert String.reverse("noël") == "lëon"
assert String.slice("noël", 0..2) == "noë"
assert String.length("noël") == 4

assert String.length("😸😾") == 2
assert String.slice("😸😾", 1..1) == "😾"
assert String.reverse("😸😾") == "😾😸"

assert String.upcase("baffle") == "BAFFLE"
end

test :split do
assert String.split("") == [""]
assert String.split("foo bar") == ["foo", "bar"]

0 comments on commit c093e37

Please sign in to comment.