aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/inline_SUITE_data
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-12-03 10:57:10 +0100
committerBjörn Gustavsson <[email protected]>2011-12-06 12:21:46 +0100
commit43a493df03174bc04d9a62edb4cff96943eebe35 (patch)
tree95b63b5f73d0aee727597563379aec093c3cd072 /lib/compiler/test/inline_SUITE_data
parent6c91e303fe844ec9a795216bb9e4d39e760cecb8 (diff)
downloadotp-43a493df03174bc04d9a62edb4cff96943eebe35.tar.gz
otp-43a493df03174bc04d9a62edb4cff96943eebe35.tar.bz2
otp-43a493df03174bc04d9a62edb4cff96943eebe35.zip
inline_SUITE: Add the comma_splitter/1 test case
Compilation would fail with an error message similar to: comma_splitter: function split_at_comma/2+32: Internal consistency check failed - please report this bug. Instruction: {put,{x,0}} Error: {match_context,{x,0}}: Noticed-by: René Kijewski
Diffstat (limited to 'lib/compiler/test/inline_SUITE_data')
-rw-r--r--lib/compiler/test/inline_SUITE_data/comma_splitter.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/compiler/test/inline_SUITE_data/comma_splitter.erl b/lib/compiler/test/inline_SUITE_data/comma_splitter.erl
new file mode 100644
index 0000000000..eaa89e0edc
--- /dev/null
+++ b/lib/compiler/test/inline_SUITE_data/comma_splitter.erl
@@ -0,0 +1,18 @@
+-module(comma_splitter).
+-export([?MODULE/0]).
+
+?MODULE() ->
+ {<<"def">>,<<"cba">>} = split_at_comma(<<"abc, def">>, <<>>),
+ ok.
+
+strip_leading_ws(<<N, Rest/binary>>) when N =< $\s ->
+ strip_leading_ws(Rest);
+strip_leading_ws(B) ->
+ B.
+
+split_at_comma(<<>>, Accu) ->
+ {<<>>, Accu};
+split_at_comma(<<$,, Rest/binary>>, Accu) ->
+ {strip_leading_ws(Rest), Accu};
+split_at_comma(<<C, Rest/binary>>, Accu) ->
+ split_at_comma(Rest, <<C, Accu/binary>>).