first tentative steps towards more comprehensive and flexible test suite

This commit is contained in:
alisdair sullivan 2013-02-06 22:28:26 -08:00
parent 51cafcfb64
commit ba42f75780
3 changed files with 31 additions and 18 deletions

17
src/jsx_tests.hrl Normal file
View file

@ -0,0 +1,17 @@
%% data and helper functions for tests
-export([init/1, handle_event/2]).
-export([empty_array/0, empty_object/0]).
-include_lib("eunit/include/eunit.hrl").
%% test handler
init([]) -> [].
handle_event(end_json, State) -> lists:reverse([end_json] ++ State);
handle_event(Event, State) -> [Event] ++ State.
empty_array() -> [{"empty array", <<"[]">>, [], [start_array, end_array, end_json]}].
empty_object() -> [{"empty object", <<"{}">>, [{}], [start_object, end_object, end_json]}].