Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/stdlib/test/string_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ trim(_) ->
?TEST(["..h", ".e", <<"j..">>], [both, ". "], "h.ej"),
?TEST(["..h", <<".ejsa"/utf8>>, "n.."], [both, ". "], "h.ejsan"),
%% Test that it behaves with graphemes (i.e. nfd tests are the hard part)
?TEST([<<"\r \r">>, []], [trailing, [$\r, [$\r, $\n]]], "\r "),
?TEST([1013,101,778,101,101], [trailing, [101]], [1013,101,778]),
?TEST("aaåaa", [both, "a"], "å"),
?TEST(["aaa",778,"äöoo"], [both, "ao"], "åäö"),
Expand Down
6 changes: 6 additions & 0 deletions lib/stdlib/test/unicode_util_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ gc(Config) ->
"hejsan" = fetch(["hej"|<<"san">>], Get),
{error, <<128>>} = Get(<<128>>),
{error, [<<128>>, 0]} = Get([<<128>>, 0]),
[$\r, <<>>, []] = Get([<<$\r>>, []]),
[$\r|<<$a>>] = Get(<<$\r,$a>>),
[$\r|<<$a>>] = Get([<<$\r,$a>>]),
[$\r, <<$a>>, []] = Get([<<$\r,$a>>, []]),
[$\r, <<$a>>, <<>>] = Get([<<$\r,$a>>, <<>>]),


{'EXIT', _} = catch Get([-1]),
{'EXIT', _} = catch Get([-1, $a]),
Expand Down
4 changes: 2 additions & 2 deletions lib/stdlib/uc_spec/gen_unicode_mod.escript
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,10 @@ gen_gc(Fd, GBP) ->
io:put_chars(Fd,
"gc([]=R) -> R;\n"
"gc([CP]=R) when ?IS_CP(CP) -> R;\n"
"gc([$\\r=CP|R0]) ->\n"
"gc([$\\r=CP|R0] = Str) ->\n"
" case cp(R0) of % Don't break CRLF\n"
" [$\\n|R1] -> [[$\\r,$\\n]|R1];\n"
" T -> [CP|T]\n"
" _ -> Str % Keep the tail binary\n"
" end;\n"
"gc([CP1|T1]=T) when ?IS_CP(CP1), CP1 < 256 ->\n"
" case T1 of\n"
Expand Down
Loading