diff options
author | Björn Gustavsson <[email protected]> | 2011-12-07 07:11:44 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-12-07 07:11:44 +0100 |
commit | 060904e7586284f899c478c42e1075643d924517 (patch) | |
tree | f0178c60caa65d38ca3961d326cd19a4057e2428 /lib/compiler/test/inline_SUITE_data/comma_splitter.erl | |
parent | 54ec1e2ccc3fd9d61be6a66db807d8a7567c2313 (diff) | |
parent | 1687a490039698fab6ccabdbbd61faa5d9d5eb41 (diff) | |
download | otp-060904e7586284f899c478c42e1075643d924517.tar.gz otp-060904e7586284f899c478c42e1075643d924517.tar.bz2 otp-060904e7586284f899c478c42e1075643d924517.zip |
Merge branch 'bjorn/compiler/inline-binary-matching/OTP-9770'
* bjorn/compiler/inline-binary-matching/OTP-9770:
beam_validator: Fix type for failure label for bs_start_match2/5
inline_SUITE: Add the comma_splitter/1 test case
Teach the compiler the 'no_dead' option
Diffstat (limited to 'lib/compiler/test/inline_SUITE_data/comma_splitter.erl')
-rw-r--r-- | lib/compiler/test/inline_SUITE_data/comma_splitter.erl | 18 |
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>>). |