Browse Source

Fixes test for R16B by avoiding sys:get_state/1

Viktor Söderqvist 10 years ago
parent
commit
1c03c60852
1 changed files with 6 additions and 1 deletions
  1. 6 1
      test/mysql_tests.erl

+ 6 - 1
test/mysql_tests.erl

@@ -41,11 +41,16 @@ connect_test() ->
     Options = [{name, {local, tardis}}, {user, ?user}, {password, ?password}],
     Options = [{name, {local, tardis}}, {user, ?user}, {password, ?password}],
     {ok, Pid} = mysql:start_link(Options),
     {ok, Pid} = mysql:start_link(Options),
     %% Test some gen_server callbacks not tested elsewhere
     %% Test some gen_server callbacks not tested elsewhere
-    State = sys:get_state(Pid),
+    State = get_state(Pid),
     ?assertMatch({ok, State}, mysql:code_change("0.1.0", State, [])),
     ?assertMatch({ok, State}, mysql:code_change("0.1.0", State, [])),
     ?assertMatch({error, _}, mysql:code_change("2.0.0", unknown_state, [])),
     ?assertMatch({error, _}, mysql:code_change("2.0.0", unknown_state, [])),
     exit(whereis(tardis), normal).
     exit(whereis(tardis), normal).
 
 
+%% For R16B where sys:get_state/1 is not available.
+get_state(Process) ->
+    {status,_,_,[_,_,_,_,Misc]} = sys:get_status(Process),
+    hd([State || {data,[{"State", State}]} <- Misc]).
+
 query_test_() ->
 query_test_() ->
     {setup,
     {setup,
      fun () ->
      fun () ->