aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/unicode_util_SUITE.erl
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2017-05-19 16:06:08 +0200
committerJosé Valim <[email protected]>2017-05-22 15:08:31 +0200
commite1370f924df65e72843b5f81400230e1c2591485 (patch)
tree73babac731e86c0903ef584d14749e1777d5f54b /lib/stdlib/test/unicode_util_SUITE.erl
parent166d11bb8cbb386dfab4fef37f6f231ac2689b61 (diff)
downloadotp-e1370f924df65e72843b5f81400230e1c2591485.tar.gz
otp-e1370f924df65e72843b5f81400230e1c2591485.tar.bz2
otp-e1370f924df65e72843b5f81400230e1c2591485.zip
Return error tuple on unicode normalization functions
Prior to this patch, the normalization functions in the unicode module would raise a function clause error for non-utf8 binaries. This patch changes it so it returns {error, SoFar, Invalid} as characters_to_binary and characters_to_list does in the unicode module. Note string:next_codepoint/1 and string:next_grapheme had to be changed accordingly and also return an error tuple.
Diffstat (limited to 'lib/stdlib/test/unicode_util_SUITE.erl')
-rw-r--r--lib/stdlib/test/unicode_util_SUITE.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/stdlib/test/unicode_util_SUITE.erl b/lib/stdlib/test/unicode_util_SUITE.erl
index e9b3d7f98d..03c24c7027 100644
--- a/lib/stdlib/test/unicode_util_SUITE.erl
+++ b/lib/stdlib/test/unicode_util_SUITE.erl
@@ -97,6 +97,8 @@ cp(_) ->
"hejsan" = fetch(<<"hejsan">>, Get),
"hejsan" = fetch(["hej",<<"san">>], Get),
"hejsan" = fetch(["hej"|<<"san">>], Get),
+ {error, <<128>>} = Get(<<128>>),
+ {error, [<<128>>, 0]} = Get([<<128>>, 0]),
ok.
gc(Config) ->
@@ -106,6 +108,8 @@ gc(Config) ->
"hejsan" = fetch(<<"hejsan">>, Get),
"hejsan" = fetch(["hej",<<"san">>], Get),
"hejsan" = fetch(["hej"|<<"san">>], Get),
+ {error, <<128>>} = Get(<<128>>),
+ {error, [<<128>>, 0]} = Get([<<128>>, 0]),
0 = fold(fun verify_gc/3, 0, DataDir ++ "/GraphemeBreakTest.txt"),
ok.