Skip to content
Browse files

Added application,[stopped] test

  • Loading branch information...
1 parent cda33a8 commit 62b252db6d28ea7904b2c5a9ed9329542f720339 Gianfranco committed
Showing with 15 additions and 3 deletions.
  1. +12 −1 src/frame_axiom.erl
  2. +3 −2 test/frame_axiom_tests.erl
View
13 src/frame_axiom.erl
@@ -111,7 +111,12 @@ snapshot(Ets,process,consumed_messages) ->
snapshot(Ets,application,started) ->
Running = [element(1,A)||A<-application:which_applications()],
ets:insert(Ets,{{application,started},Running}),
+ Ets;
+snapshot(Ets,application,stopped) ->
+ Running = [element(1,A)||A<-application:which_applications()],
+ ets:insert(Ets,{{application,stopped},Running}),
Ets.
+
diff(Ets,[X]) ->
diff(Ets,X);
@@ -232,7 +237,13 @@ diff(Ets,application,started) ->
Running = [element(1,A)||A<-application:which_applications()],
Key = {application,started},
[{Key,Recorded}] = ets:lookup(Ets,Key),
- [{started,S}||S<-Running,not lists:member(S,Recorded)].
+ [{started,S}||S<-Running,not lists:member(S,Recorded)];
+diff(Ets,application,stopped) ->
+ Running = [element(1,A)||A<-application:which_applications()],
+ Key = {application,stopped},
+ [{Key,Recorded}] = ets:lookup(Ets,Key),
+ [{stopped,S}||S<-Recorded,not lists:member(S,Running)].
+
View
5 test/frame_axiom_tests.erl
@@ -140,10 +140,11 @@ application_creation_diff_test() ->
application:stop(snmp).
application_stop_diff_test() ->
+ Options = [stopped],
application:start(snmp),
- Ref = frame_axiom:snapshot(application),
+ Ref = frame_axiom:snapshot([{application,Options}]),
application:stop(snmp),
- ?assertEqual([{stopped,snmp}],frame_axiom:diff(Ref,application,start_stop)).
+ ?assertEqual([{stopped,snmp}],frame_axiom:diff(Ref,[{application,Options}])).
application_no_change_diff_test() ->
Ref = frame_axiom:snapshot(application),

0 comments on commit 62b252d

Please sign in to comment.
Something went wrong with that request. Please try again.