Skip to content

Instantly share code, notes, and snippets.

@manpages
Created March 30, 2012 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manpages/2257850 to your computer and use it in GitHub Desktop.
Save manpages/2257850 to your computer and use it in GitHub Desktop.
Yet Another Erlang/Unicode Fuckup
-module(reduced_test_case).
-define(NODEBUG, 1).
-include_lib("eunit/include/eunit.hrl").
-behavior(gen_server).
%-compile(export_all).
-export([init/1, code_change/3, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
-export([start/0]).
-define(SERVER, ?MODULE).
start() ->
{ok, PID} = gen_server:start_link({local, ?SERVER}, ?MODULE, [], []),
PID ! {hi, [1040,1044]},
{ok, PID}.
handle_call(_Msg, _Caller, State) -> {noreply, State}.
handle_info({hi, Data}, State) -> io:format("~ts~n", [Data]), {noreply, State};
handle_info(_Msg, State) -> {noreply, State}.
handle_cast(_Msg, State) -> {noreply, State}.
terminate(_Reason, _State) -> ok.
code_change(_OldVersion, State, _Extra) -> {ok, State}.
init(_) -> {ok, []}.
echo "Reduced test case:"
cat reduced_test_case.erl
erlc reduced_test_case.erl
echo
echo "==="
echo "Running erl -eval \"reduced_test_case:start()\" with keys"
echo "* -run init stop"
echo
echo "<output>"
erl -eval "reduced_test_case:start()" -run init stop
echo "</output>"
echo
echo
echo "==="
echo "Running erl -eval \"reduced_test_case:start()\" with keys"
echo "* -run init stop -noshell"
echo
echo "<output>"
erl -eval "reduced_test_case:start()" -run init stop -noshell
echo "</output>"
echo
echo
echo
echo "Feel the difference."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment