Permalink
Browse files

Fixes error handling and disables (sic!) UTF8 checking

This patch once again fixes error handling. To have couchdb's tests complete it
disables UTF8 character checks: apparently the couchdb project and yajl disagree on what is invalid UTF8 code :)
  • Loading branch information...
eno
eno committed Jan 25, 2009
1 parent 0ccf7fd commit e3890e04b8503febbdf5b3c77f0ea4036fff6ccb
Showing with 22 additions and 16 deletions.
  1. +9 −10 src/eep0018.erl
  2. +1 −1 src/json_parse.c
  3. +4 −3 tests/runner
  4. +8 −2 tests/src/runner.erl
View
@@ -136,17 +136,10 @@ list_to_number_fun(number) -> fun identity/1.
receive_value(InternOption) ->
receive
{ _, { _, [ ?EI | DATA ] } } ->
-
- Adjusted = case erlang:binary_to_term(DATA) of
- {error, _} -> throw(badarg);
- R -> adjust(InternOption, R, InternOption#options.objects)
- end,
-
- case InternOption#options.parse of
- object -> Adjusted;
- value -> [ VALUE ] = Adjusted, VALUE
+ case erlang:binary_to_term(DATA) of
+ {error, M} -> {error, M};
+ R -> adjust(InternOption, R)
end
- % UNKNOWN -> io:format("UNKNOWN 1 ~p ~n", [UNKNOWN]), UNKNOWN
end.
%% adjust returned term %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -187,6 +180,12 @@ adjust(O, In, eep0018) -> adjust(O, In, nop_options(O));
adjust(_, In, true) -> In;
adjust(O, In, _) -> adjust_eep0018(O, In).
+adjust(O, In) ->
+ case O#options.parse of
+ object -> In;
+ value -> [ VALUE ] = In, VALUE
+ end.
+
%
loop(Port) ->
View
@@ -291,7 +291,7 @@ void json_parse_to_ei(ErlDrvData session, const unsigned char* s, int len, int o
state.skip_list_header_for_value = -1;
state.options = opts;
- yajl_parser_config conf = { YAJL_ALLOW_COMMENTS, YAJL_CHECK_UTF8 };
+ yajl_parser_config conf = { YAJL_ALLOW_COMMENTS }; // , YAJL_CHECK_UTF8 };
yajl_handle handle = yajl_alloc(&callbacks, &conf, &state);
/* start parser */
View
@@ -3,10 +3,11 @@ cd $(dirname $0)
make -C ..
make -C src
-#erl -pa ../bin ./src -eval 'runner:run([ "testcases" ]).'
+erl -pa ../bin ./src -eval 'runner:run([ "testcases" ]).'
#erl -pa ../bin ./src -eval 'runner:parallel([ "testcases", "benchmark" ]).'
-erl -pa ../bin ./src -eval 'runner:parallel([ "benchmark" ]).'
-#erl -pa ../bin ./src -eval 'runner:run_case("testcases/01").'
+#erl -pa ../bin ./src -eval 'runner:parallel([ "benchmark" ]).'
+#erl -pa ../bin ./src -eval 'runner:run_case("testcases/couch_utf8").'
+
#erl -pa ../bin ./src -eval 'runner:run([ "testcases", "yajl" ]).'
View
@@ -1,5 +1,6 @@
-module(runner).
-export([run/1]).
+-export([run_case/1]).
-export([parallel/1]).
-export([benchmark/1]).
@@ -16,8 +17,8 @@
% ,[ eep0018, [{float, false}, {labels, binary}] ]
% ,[ eep0018, [{float, intern}, {labels, atom}] ]
% ,[ eep0018, [{float, intern}, {labels, binary}] ]
-% ,[ mochijson2 ]
-% ,[ rabbitmq ]
+ ,[ mochijson2 ]
+ ,[ rabbitmq ]
]
).
@@ -26,6 +27,11 @@ run(A) ->
lists:foreach(fun(Subdir) -> do_run(Subdir) end, A),
init:stop().
+run_case(X) ->
+ eep0018:start("../bin"),
+ lists:foreach(fun(C) -> testcase:run_case(X,C) end, ?TEST_CONFIGURATIONS),
+ init:stop().
+
do_run(Subdir) ->
lists:foreach(fun(C) -> testcase:run(Subdir, C) end, ?TEST_CONFIGURATIONS).

0 comments on commit e3890e0

Please sign in to comment.