return json_check (json_false ());
else if (EQ (lisp, Qt))
return json_check (json_true ());
- else if (FIXNUMP (lisp))
+ else if (INTEGERP (lisp))
{
- CHECK_TYPE_RANGED_INTEGER (json_int_t, lisp);
- return json_check (json_integer (XFIXNUM (lisp)));
+ intmax_t low = TYPE_MINIMUM (json_int_t);
+ intmax_t high = TYPE_MAXIMUM (json_int_t);
+ intmax_t value;
+ if (! integer_to_intmax (lisp, &value) || value < low || high < value)
+ args_out_of_range_3 (lisp, make_int (low), make_int (high));
+ return json_check (json_integer (value));
}
else if (FLOATP (lisp))
return json_check (json_real (XFLOAT_DATA (lisp)));
:type 'no-catch)
(should (equal calls 1)))))
+(ert-deftest json-serialize/bignum ()
+ (skip-unless (fboundp 'json-serialize))
+ (should (equal (json-serialize (vector (1+ most-positive-fixnum)
+ (1- most-negative-fixnum)))
+ (format "[%d,%d]"
+ (1+ most-positive-fixnum)
+ (1- most-negative-fixnum)))))
+
(provide 'json-tests)
;;; json-tests.el ends here