anchor.diff:          %% we don't support code points > 10FFFF per RFC 3629
           <<?Q, 16#F5, 16#80, 16#80, 16#80, ?Q>>
       ],
  -    lists:foreach(fun(X) ->
  -        ok = try decode(X) catch invalid_utf8 -> ok end
  -    end, Bad).
  +    lists:foreach(
  +      fun(X) ->
  +              ok = try decode(X) catch invalid_utf8 -> ok end,
  +              %% could be {ucs,{bad_utf8_character_code}} or
  +              %%          {json_encode,{bad_char,_}}
  +              {'EXIT', _} = (catch encode(X))
  +      end, Bad).
   
   inline_json_test() ->
       ?assertEqual(<<"\"iodata iodata\"">>,
  
positive.code:     {struct, []}.
  
  is_obj({struct, Props}) ->
      F = fun ({K, _}) when is_binary(K) ->
                  true;
              (_) ->
                  false
          end,
      lists:all(F, Props).
  
  obj_from_list(Props) ->
      Obj = {struct, Props},
      case is_obj(Obj) of
          true -> Obj;
          false -> exit({json_bad_object, Obj})
      end.
  
  %% Test for equivalence of Erlang terms.
  %% Due to arbitrary order of construction, equivalent objects might
  
negative.code:     ?assertEqual(<<"2147483648.0">>, iolist_to_binary(encode(2147483648))),
      ok.
  
  handler_test() ->
      ?assertEqual(
         {'EXIT',{json_encode,{bad_term,{}}}},
         catch encode({})),
      F = fun ({}) -> [] end,
      ?assertEqual(
         <<"[]">>,
         iolist_to_binary((encoder([{handler, F}]))({}))),
      ok.
  
  -endif.
  