aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/binref.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/test/binref.erl')
-rw-r--r--lib/stdlib/test/binref.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/stdlib/test/binref.erl b/lib/stdlib/test/binref.erl
index d93f82fda9..484112428c 100644
--- a/lib/stdlib/test/binref.erl
+++ b/lib/stdlib/test/binref.erl
@@ -143,8 +143,16 @@ split(H,N) ->
split(H,N,[]).
split(Haystack,{Needles},Options) ->
split(Haystack, Needles, Options);
-split(Haystack,Needles,Options) ->
+split(Haystack,Needles0,Options) ->
try
+ Needles = if
+ is_list(Needles0) ->
+ Needles0;
+ is_binary(Needles0) ->
+ [Needles0];
+ true ->
+ exit(badtype)
+ end,
{Part,Global,Trim} = get_opts_split(Options,{nomatch,false,false}),
{Start,End,NewStack} =
case Part of
@@ -203,8 +211,16 @@ replace(H,N,R) ->
replace(Haystack,{Needles},Replacement,Options) ->
replace(Haystack,Needles,Replacement,Options);
-replace(Haystack,Needles,Replacement,Options) ->
+replace(Haystack,Needles0,Replacement,Options) ->
try
+ Needles = if
+ is_list(Needles0) ->
+ Needles0;
+ is_binary(Needles0) ->
+ [Needles0];
+ true ->
+ exit(badtype)
+ end,
true = is_binary(Replacement), % Make badarg instead of function clause
{Part,Global,Insert} = get_opts_replace(Options,{nomatch,false,[]}),
{Start,End,NewStack} =