Permalink
Browse files

Add a non-linked startup for testing in shell

  • Loading branch information...
1 parent 3a5111e commit a0719c8f8d47420461f091331a8b2253cd836bd5 @msantos committed Apr 1, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/sut.erl
View
@@ -36,7 +36,7 @@
destroy/1
]).
--export([start_link/1]).
+-export([start/1, start_link/1]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
@@ -47,10 +47,11 @@
destroy(Ref) when is_pid(Ref) ->
gen_server:call(Ref, destroy).
+start(Opt) when is_list(Opt) ->
+ gen_server:start(?MODULE, [options(Opt)], []).
+
start_link(Opt) when is_list(Opt) ->
- Fun = ?PROPLIST_TO_RECORD(sut_state),
- State = Fun(Opt),
- gen_server:start_link(?MODULE, [State], []).
+ gen_server:start_link(?MODULE, [options(Opt)], []).
%%--------------------------------------------------------------------
@@ -158,3 +159,7 @@ aton(Address) when is_list(Address) ->
N;
aton(Address) when is_tuple(Address) ->
Address.
+
+options(Opt) ->
+ Fun = ?PROPLIST_TO_RECORD(sut_state),
+ Fun(Opt).

0 comments on commit a0719c8

Please sign in to comment.