Permalink
Browse files

Deletion for ets to new style interface

  • Loading branch information...
1 parent ecf9c40 commit bc7ec6c1993274d739b9bb478aa6c288fd789e6b Gianfranco committed Jul 1, 2011
Showing with 15 additions and 3 deletions.
  1. +12 −1 src/frame_axiom.erl
  2. +3 −2 test/frame_axiom_tests.erl
View
@@ -132,7 +132,12 @@ snapshot(Ets,application,unloaded) ->
snapshot(Ets,ets,creation) ->
Existing = ets:all(),
ets:insert(Ets,{{ets,creation},Existing}),
+ Ets;
+snapshot(Ets,ets,deletion) ->
+ Existing = ets:all(),
+ ets:insert(Ets,{{ets,deletion},Existing}),
Ets.
+
diff(Ets,[X]) ->
diff(Ets,X);
@@ -271,7 +276,13 @@ diff(Ets,ets,creation) ->
Current = ets:all(),
Key = {ets,creation},
[{Key,Recorded}] = ets:lookup(Ets,Key),
- [{created,E}||E<-Current,not lists:member(E,Recorded)].
+ [{created,E}||E<-Current,not lists:member(E,Recorded)];
+diff(Ets,ets,deletion) ->
+ Current = ets:all(),
+ Key = {ets,deletion},
+ [{Key,Recorded}] = ets:lookup(Ets,Key),
+ [{deleted,E}||E<-Recorded,not lists:member(E,Current)].
+
@@ -192,10 +192,11 @@ ets_creation_diff_test() ->
?assertEqual([{created,New}],frame_axiom:diff(Ref,[{ets,Options}])).
ets_delection_diff_test() ->
+ Options = [deletion],
E = ets:new(some,[]),
- Ref = frame_axiom:snapshot(ets),
+ Ref = frame_axiom:snapshot([{ets,Options}]),
ets:delete(E),
- ?assertEqual([{deleted,E}],frame_axiom:diff(Ref,ets)).
+ ?assertEqual([{deleted,E}],frame_axiom:diff(Ref,[{ets,Options}])).
ets_no_change_test() ->
Ref = frame_axiom:snapshot(ets),

0 comments on commit bc7ec6c

Please sign in to comment.