move clean_string to an include file and inline it in parser and encoder, move tests to jsx_test.hrl

This commit is contained in:
alisdair sullivan 2013-03-06 01:28:39 -08:00
parent dd302eb7b4
commit c4405e45a8
5 changed files with 884 additions and 866 deletions

View file

@ -198,17 +198,19 @@ fix_key(Key) when is_binary(Key) -> Key.
clean_string(Bin, Tokens, Handler, Stack, Config) ->
try jsx_utils:clean_string(Bin, Config)
catch error:badarg -> ?error(string, [{string, Bin}|Tokens], Handler, Stack, Config)
case clean_string(Bin, Config) of
{error, badarg} -> ?error(string, [{string, Bin}|Tokens], Handler, Stack, Config);
String -> String
end.
-include("jsx_strings.hrl").
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
parse(Events, Config) ->
Chunk = try
value(Events ++ [end_json], {jsx, []}, [], jsx_utils:parse_config(Config))