Permalink
Browse files

Removed json feature

  • Loading branch information...
1 parent e1d768e commit 3b5c76e9b5766eb914b5e2d83e2372fde2e2b44f @Gianfrancoalongi committed Dec 4, 2012
Showing with 4 additions and 63 deletions.
  1. +2 −15 run1/src/mrz.erl
  2. +1 −7 run1/src/mrz_data.erl
  3. +1 −37 run1/src/mrz_tests.erl
  4. +0 −4 run1/test/mrz_data_tests.erl
View
@@ -12,11 +12,6 @@ seq_apply([],X) ->
seq_apply([F|T],X) ->
seq_apply(T,F(X)).
-choose_X([{input_json,File}|_]) ->
- {ok,R} = file:read_file(File),
- fun() ->
- mrz_data:from_json(R)
- end;
choose_X([]) ->
fun mrz_data:hello_world/0;
choose_X([_|T]) ->
@@ -31,13 +26,5 @@ choose_Os(Options) ->
{cap2H,fun mrz_transform:cap2H/1},
{cap1H,fun mrz_transform:cap1H/1}
],
- lists:foldr(
- fun(Option,Acc) ->
- case proplists:get_value(Option,O_lookup) of
- undefined -> Acc;
- V ->
- [V|Acc]
- end
- end,
- [],
- Options).
+ [ proplists:get_value(Opt,O_lookup) || Opt <- Options].
+
View
@@ -1,12 +1,6 @@
-module(mrz_data).
--export([hello_world/0,
- from_json/1
+-export([hello_world/0
]).
hello_world() ->
"hello world".
-
-from_json(String) ->
- {struct,Proplist} = mochijson2:decode(String),
- binary_to_list(proplists:get_value(<<"data">>,Proplist)).
-
View
@@ -9,45 +9,9 @@ mrz_options_test_() ->
fun no_option_test_function/1,
fun rev2_test_function/1,
fun cap2H_test_function/1,
- fun cap1H_test_function/1,
- fun input_from_json_test_function/1,
- fun input_from_json_and_cap1h_test_function/1,
- fun input_from_json_and_cap2h_test_function/1,
- fun input_from_json_and_rev2_test_function/1
+ fun cap1H_test_function/1
]}.
-input_from_json_and_rev2_test_function(FileHandle) ->
- fun() ->
- group_leader(FileHandle,self()),
- mrz:run([{input_json,"./input_data.json"},rev2]),
- {ok,Res} = file:read_file("test_res.txt"),
- ?assertEqual(<<"hello dlrow json elif">>,Res)
- end.
-
-input_from_json_and_cap2h_test_function(FileHandle) ->
- fun() ->
- group_leader(FileHandle,self()),
- mrz:run([{input_json,"./input_data.json"},cap2H]),
- {ok,Res} = file:read_file("test_res.txt"),
- ?assertEqual(<<"hello world JSON FILE">>,Res)
- end.
-
-input_from_json_and_cap1h_test_function(FileHandle) ->
- fun() ->
- group_leader(FileHandle,self()),
- mrz:run([{input_json,"./input_data.json"},cap1H]),
- {ok,Res} = file:read_file("test_res.txt"),
- ?assertEqual(<<"HELLO WORLD json file">>,Res)
- end.
-
-input_from_json_test_function(FileHandle) ->
- fun() ->
- group_leader(FileHandle,self()),
- mrz:run([{input_json,"./input_data.json"}]),
- {ok,Res} = file:read_file("test_res.txt"),
- ?assertEqual(<<"hello world json file">>,Res)
- end.
-
cap1H_test_function(FileHandle) ->
fun() ->
group_leader(FileHandle,self()),
@@ -3,7 +3,3 @@
hello_world_test() ->
?assertEqual("hello world",mrz_data:hello_world()).
-
-from_json_test() ->
- Input = "{\"data\":\"json string\"}",
- ?assertEqual("json string",mrz_data:from_json(Input)).

0 comments on commit 3b5c76e

Please sign in to comment.