summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2015-01-02 21:31:20 +0100
committerFlorian Frank <flori@ping.de>2015-01-02 21:31:20 +0100
commitcb3656bb25eb37eb02a4d955a6e4c094aecf74f4 (patch)
treec7426fc85de55662eb02f6cc00c486195242fb30
parent6ae8732ef0e7a59e3457495f150c582301c00c7c (diff)
parentb798187c278beea246b0f709754ebd34eaae074e (diff)
downloadjson-cb3656bb25eb37eb02a4d955a6e4c094aecf74f4.tar.gz
Merge branch 'ruby-2.2' of https://github.com/zzak/json into zzak-ruby-2.2
Conflicts: .travis.yml json.gemspec json_pure.gemspec
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml4
-rw-r--r--ext/json/ext/fbuffer/fbuffer.h11
-rw-r--r--ext/json/ext/generator/extconf.rb10
-rw-r--r--ext/json/ext/generator/generator.c42
-rw-r--r--ext/json/ext/generator/generator.h12
-rw-r--r--ext/json/ext/parser/extconf.rb10
-rw-r--r--ext/json/ext/parser/parser.c25
-rw-r--r--ext/json/ext/parser/parser.h9
-rw-r--r--ext/json/ext/parser/parser.rl25
-rw-r--r--ext/json/extconf.rb3
-rw-r--r--json-java.gemspec2
-rw-r--r--json.gemspecbin4942 -> 5008 bytes
-rw-r--r--json_pure.gemspec6
-rw-r--r--lib/json/common.rb2
-rwxr-xr-xtests/test_json.rb2
-rwxr-xr-xtests/test_json_generate.rb18
17 files changed, 125 insertions, 59 deletions
diff --git a/.gitignore b/.gitignore
index 297633e..5ef62af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.*.sw[pon]
+*.bundle
coverage
tags
pkg
@@ -11,3 +12,5 @@ Gemfile.lock
.rbx
.AppleDouble
.DS_Store
+*/**/Makefile
+*/**/*.o
diff --git a/.travis.yml b/.travis.yml
index 93916a0..c0d1d34 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
# Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
-bundler_args: --binstubs
+#bundler_args: --binstubs
# Specify which ruby versions you wish to run your tests on, each version will be used
rvm:
@@ -8,6 +8,7 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1
+ - 2.2
- ree
- rbx-18mode
- rbx-19mode
@@ -18,4 +19,5 @@ matrix:
allow_failures:
- rvm: rbx-18mode
- rvm: rbx-19mode
+ - rvm: ruby-head
script: "bundle exec rake"
diff --git a/ext/json/ext/fbuffer/fbuffer.h b/ext/json/ext/fbuffer/fbuffer.h
index af74187..5a0a27c 100644
--- a/ext/json/ext/fbuffer/fbuffer.h
+++ b/ext/json/ext/fbuffer/fbuffer.h
@@ -25,6 +25,15 @@
#define RSTRING_LEN(string) RSTRING(string)->len
#endif
+#ifdef PRIsVALUE
+# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
+# define RB_OBJ_STRING(obj) (obj)
+#else
+# define PRIsVALUE "s"
+# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
+# define RB_OBJ_STRING(obj) StringValueCStr(obj)
+#endif
+
#ifdef HAVE_RUBY_ENCODING_H
#include "ruby/encoding.h"
#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
@@ -172,7 +181,7 @@ static FBuffer *fbuffer_dup(FBuffer *fb)
static VALUE fbuffer_to_s(FBuffer *fb)
{
- VALUE result = rb_str_new(FBUFFER_PAIR(fb));
+ VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));
fbuffer_free(fb);
FORCE_UTF8(result);
return result;
diff --git a/ext/json/ext/generator/extconf.rb b/ext/json/ext/generator/extconf.rb
index c947501..8627c5f 100644
--- a/ext/json/ext/generator/extconf.rb
+++ b/ext/json/ext/generator/extconf.rb
@@ -1,14 +1,4 @@
require 'mkmf'
-unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
- $CFLAGS << ' -O3'
-end
-if CONFIG['CC'] =~ /gcc/
- $CFLAGS << ' -Wall'
- unless $DEBUG && !$CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
- $CFLAGS << ' -O0 -ggdb'
- end
-end
-
$defs << "-DJSON_GENERATOR"
create_makefile 'json/ext/generator'
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c
index 976afc5..f789a89 100644
--- a/ext/json/ext/generator/generator.c
+++ b/ext/json/ext/generator/generator.c
@@ -486,8 +486,9 @@ static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self)
return cState_partial_generate(state, string);
}
-static void State_free(JSON_Generator_State *state)
+static void State_free(void *ptr)
{
+ JSON_Generator_State *state = ptr;
if (state->indent) ruby_xfree(state->indent);
if (state->space) ruby_xfree(state->space);
if (state->space_before) ruby_xfree(state->space_before);
@@ -499,7 +500,31 @@ static void State_free(JSON_Generator_State *state)
ruby_xfree(state);
}
-static JSON_Generator_State *State_allocate()
+static size_t State_memsize(const void *ptr)
+{
+ const JSON_Generator_State *state = ptr;
+ size_t size = sizeof(*state);
+ if (state->indent) size += state->indent_len + 1;
+ if (state->space) size += state->space_len + 1;
+ if (state->space_before) size += state->space_before_len + 1;
+ if (state->object_nl) size += state->object_nl_len + 1;
+ if (state->array_nl) size += state->array_nl_len + 1;
+ if (state->array_delim) size += FBUFFER_CAPA(state->array_delim);
+ if (state->object_delim) size += FBUFFER_CAPA(state->object_delim);
+ if (state->object_delim2) size += FBUFFER_CAPA(state->object_delim2);
+ return size;
+}
+
+static const rb_data_type_t JSON_Generator_State_type = {
+ "JSON/Generator/State",
+ {NULL, State_free, State_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
+ 0, 0,
+ RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
+};
+
+static JSON_Generator_State *State_allocate(void)
{
JSON_Generator_State *state = ALLOC(JSON_Generator_State);
MEMZERO(state, JSON_Generator_State, 1);
@@ -509,7 +534,7 @@ static JSON_Generator_State *State_allocate()
static VALUE cState_s_allocate(VALUE klass)
{
JSON_Generator_State *state = State_allocate();
- return Data_Wrap_Struct(klass, NULL, State_free, state);
+ return TypedData_Wrap_Struct(klass, &JSON_Generator_State_type, state);
}
/*
@@ -812,10 +837,10 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St
if (!allow_nan) {
if (isinf(value)) {
fbuffer_free(buffer);
- rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
} else if (isnan(value)) {
fbuffer_free(buffer);
- rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
}
}
fbuffer_append_str(buffer, tmp);
@@ -965,8 +990,9 @@ static VALUE cState_init_copy(VALUE obj, VALUE orig)
{
JSON_Generator_State *objState, *origState;
- Data_Get_Struct(obj, JSON_Generator_State, objState);
- Data_Get_Struct(orig, JSON_Generator_State, origState);
+ if (obj == orig) return obj;
+ GET_STATE_TO(obj, objState);
+ GET_STATE_TO(orig, origState);
if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State");
MEMCPY(objState, origState, JSON_Generator_State, 1);
@@ -1326,7 +1352,7 @@ static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_l
/*
*
*/
-void Init_generator()
+void Init_generator(void)
{
rb_require("json/common");
diff --git a/ext/json/ext/generator/generator.h b/ext/json/ext/generator/generator.h
index e2fbf12..7bf8408 100644
--- a/ext/json/ext/generator/generator.h
+++ b/ext/json/ext/generator/generator.h
@@ -78,9 +78,12 @@ typedef struct JSON_Generator_StateStruct {
long buffer_initial_length;
} JSON_Generator_State;
+#define GET_STATE_TO(self, state) \
+ TypedData_Get_Struct(self, JSON_Generator_State, &JSON_Generator_State_type, state)
+
#define GET_STATE(self) \
JSON_Generator_State *state; \
- Data_Get_Struct(self, JSON_Generator_State, state)
+ GET_STATE_TO(self, state)
#define GENERATE_JSON(type) \
FBuffer *buffer; \
@@ -89,7 +92,7 @@ typedef struct JSON_Generator_StateStruct {
\
rb_scan_args(argc, argv, "01", &Vstate); \
Vstate = cState_from_state_s(cState, Vstate); \
- Data_Get_Struct(Vstate, JSON_Generator_State, state); \
+ TypedData_Get_Struct(Vstate, JSON_Generator_State, &JSON_Generator_State_type, state); \
buffer = cState_prepare_buffer(Vstate); \
generate_json_##type(buffer, Vstate, state, self); \
return fbuffer_to_s(buffer)
@@ -108,8 +111,8 @@ static VALUE mTrueClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self);
static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self);
-static void State_free(JSON_Generator_State *state);
-static JSON_Generator_State *State_allocate();
+static void State_free(void *state);
+static JSON_Generator_State *State_allocate(void);
static VALUE cState_s_allocate(VALUE klass);
static VALUE cState_configure(VALUE self, VALUE opts);
static VALUE cState_to_h(VALUE self);
@@ -144,5 +147,6 @@ static VALUE cState_ascii_only_p(VALUE self);
static VALUE cState_depth(VALUE self);
static VALUE cState_depth_set(VALUE self, VALUE depth);
static FBuffer *cState_prepare_buffer(VALUE self);
+static const rb_data_type_t JSON_Generator_State_type;
#endif
diff --git a/ext/json/ext/parser/extconf.rb b/ext/json/ext/parser/extconf.rb
index 4791829..ae4f861 100644
--- a/ext/json/ext/parser/extconf.rb
+++ b/ext/json/ext/parser/extconf.rb
@@ -1,13 +1,3 @@
require 'mkmf'
-unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
- $CFLAGS << ' -O3'
-end
-if CONFIG['CC'] =~ /gcc/
- $CFLAGS << ' -Wall'
- if $DEBUG && !$CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
- $CFLAGS << ' -O0 -ggdb'
- end
-end
-
create_makefile 'json/ext/parser'
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c
index e91e161..efb4dac 100644
--- a/ext/json/ext/parser/parser.c
+++ b/ext/json/ext/parser/parser.c
@@ -2092,7 +2092,7 @@ static VALUE cParser_parse(VALUE self)
}
-static JSON_Parser *JSON_allocate()
+static JSON_Parser *JSON_allocate(void)
{
JSON_Parser *json = ALLOC(JSON_Parser);
MEMZERO(json, JSON_Parser, 1);
@@ -2100,8 +2100,9 @@ static JSON_Parser *JSON_allocate()
return json;
}
-static void JSON_mark(JSON_Parser *json)
+static void JSON_mark(void *ptr)
{
+ JSON_Parser *json = ptr;
rb_gc_mark_maybe(json->Vsource);
rb_gc_mark_maybe(json->create_id);
rb_gc_mark_maybe(json->object_class);
@@ -2109,16 +2110,32 @@ static void JSON_mark(JSON_Parser *json)
rb_gc_mark_maybe(json->match_string);
}
-static void JSON_free(JSON_Parser *json)
+static void JSON_free(void *ptr)
{
+ JSON_Parser *json = ptr;
fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
+static size_t JSON_memsize(const void *ptr)
+{
+ const JSON_Parser *json = ptr;
+ return sizeof(*json) + FBUFFER_CAPA(json->fbuffer);
+}
+
+static const rb_data_type_t JSON_Parser_type = {
+ "JSON/Parser",
+ {JSON_mark, JSON_free, JSON_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
+ 0, 0,
+ RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
+};
+
static VALUE cJSON_parser_s_allocate(VALUE klass)
{
JSON_Parser *json = JSON_allocate();
- return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
+ return TypedData_Wrap_Struct(klass, &JSON_Parser_type, json);
}
/*
diff --git a/ext/json/ext/parser/parser.h b/ext/json/ext/parser/parser.h
index b192064..45afbc2 100644
--- a/ext/json/ext/parser/parser.h
+++ b/ext/json/ext/parser/parser.h
@@ -51,7 +51,7 @@ typedef struct JSON_ParserStruct {
if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance")
#define GET_PARSER_INIT \
JSON_Parser *json; \
- Data_Get_Struct(self, JSON_Parser, json)
+ TypedData_Get_Struct(self, JSON_Parser, &JSON_Parser_type, json)
#define MinusInfinity "-Infinity"
#define EVIL 0x666
@@ -68,10 +68,11 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
static VALUE convert_encoding(VALUE source);
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
static VALUE cParser_parse(VALUE self);
-static JSON_Parser *JSON_allocate();
-static void JSON_mark(JSON_Parser *json);
-static void JSON_free(JSON_Parser *json);
+static JSON_Parser *JSON_allocate(void);
+static void JSON_mark(void *json);
+static void JSON_free(void *json);
static VALUE cJSON_parser_s_allocate(VALUE klass);
static VALUE cParser_source(VALUE self);
+static const rb_data_type_t JSON_Parser_type;
#endif
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
index c60e35c..d3ba554 100644
--- a/ext/json/ext/parser/parser.rl
+++ b/ext/json/ext/parser/parser.rl
@@ -815,7 +815,7 @@ static VALUE cParser_parse(VALUE self)
}
-static JSON_Parser *JSON_allocate()
+static JSON_Parser *JSON_allocate(void)
{
JSON_Parser *json = ALLOC(JSON_Parser);
MEMZERO(json, JSON_Parser, 1);
@@ -823,8 +823,9 @@ static JSON_Parser *JSON_allocate()
return json;
}
-static void JSON_mark(JSON_Parser *json)
+static void JSON_mark(void *ptr)
{
+ JSON_Parser *json = ptr;
rb_gc_mark_maybe(json->Vsource);
rb_gc_mark_maybe(json->create_id);
rb_gc_mark_maybe(json->object_class);
@@ -832,16 +833,32 @@ static void JSON_mark(JSON_Parser *json)
rb_gc_mark_maybe(json->match_string);
}
-static void JSON_free(JSON_Parser *json)
+static void JSON_free(void *ptr)
{
+ JSON_Parser *json = ptr;
fbuffer_free(json->fbuffer);
ruby_xfree(json);
}
+static size_t JSON_memsize(const void *ptr)
+{
+ const JSON_Parser *json = ptr;
+ return sizeof(*json) + FBUFFER_CAPA(json->fbuffer);
+}
+
+static const rb_data_type_t JSON_Parser_type = {
+ "JSON/Parser",
+ {JSON_mark, JSON_free, JSON_memsize,},
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
+ 0, 0,
+ RUBY_TYPED_FREE_IMMEDIATELY,
+#endif
+};
+
static VALUE cJSON_parser_s_allocate(VALUE klass)
{
JSON_Parser *json = JSON_allocate();
- return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
+ return TypedData_Wrap_Struct(klass, &JSON_Parser_type, json);
}
/*
diff --git a/ext/json/extconf.rb b/ext/json/extconf.rb
new file mode 100644
index 0000000..850798c
--- /dev/null
+++ b/ext/json/extconf.rb
@@ -0,0 +1,3 @@
+require 'mkmf'
+create_makefile('json')
+
diff --git a/json-java.gemspec b/json-java.gemspec
index 79d8e3a..14864f8 100644
--- a/json-java.gemspec
+++ b/json-java.gemspec
@@ -11,7 +11,7 @@ spec = Gem::Specification.new do |s|
s.homepage = "http://json-jruby.rubyforge.org/"
s.platform = 'java'
s.rubyforge_project = "json-jruby"
- s.license = "Ruby"
+ s.licenses = ["Ruby"]
s.files = Dir["{docs,lib,tests}/**/*"]
end
diff --git a/json.gemspec b/json.gemspec
index 259b236..9fbc284 100644
--- a/json.gemspec
+++ b/json.gemspec
Binary files differ
diff --git a/json_pure.gemspec b/json_pure.gemspec
index 40f5902..9847e5e 100644
--- a/json_pure.gemspec
+++ b/json_pure.gemspec
@@ -8,15 +8,15 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Florian Frank"]
- s.date = "2014-07-03"
+ s.date = "2015-01-02"
s.description = "This is a JSON implementation in pure Ruby."
s.email = "flori@ping.de"
s.extra_rdoc_files = ["README.rdoc"]
- s.files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb", ".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb"]
+ s.files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb", ".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "ext/json/extconf.rb", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb"]
s.homepage = "http://flori.github.com/json"
s.licenses = ["Ruby"]
s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
- s.rubygems_version = "2.2.2"
+ s.rubygems_version = "2.4.5"
s.summary = "JSON Implementation for Ruby"
s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
diff --git a/lib/json/common.rb b/lib/json/common.rb
index e24f637..8fbaa2b 100644
--- a/lib/json/common.rb
+++ b/lib/json/common.rb
@@ -448,7 +448,7 @@ module ::Kernel
nil
end
- # Ouputs _objs_ to STDOUT as JSON strings in a pretty format, with
+ # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with
# indentation and over many lines.
def jj(*objs)
objs.each do |obj|
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 6af6b32..462650e 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -491,6 +491,8 @@ EOT
assert_equal @hash, JSON.load(stringio)
assert_equal nil, JSON.load(nil)
assert_equal nil, JSON.load('')
+ ensure
+ tempfile.close!
end
def test_load_with_options
diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb
index 117a155..ea6a9a3 100755
--- a/tests/test_json_generate.rb
+++ b/tests/test_json_generate.rb
@@ -215,16 +215,18 @@ EOT
end
def test_gc
- bignum_too_long_to_embed_as_string = 1234567890123456789012345
- expect = bignum_too_long_to_embed_as_string.to_s
- stress, GC.stress = GC.stress, true
+ if respond_to?(:assert_in_out_err)
+ assert_in_out_err(%w[-rjson --disable-gems], <<-EOS, [], [])
+ bignum_too_long_to_embed_as_string = 1234567890123456789012345
+ expect = bignum_too_long_to_embed_as_string.to_s
+ GC.stress = true
- 10.times do |i|
- tmp = bignum_too_long_to_embed_as_string.to_json
- assert_equal expect, tmp
+ 10.times do |i|
+ tmp = bignum_too_long_to_embed_as_string.to_json
+ raise "'\#{expect}' is expected, but '\#{tmp}'" unless tmp == expect
+ end
+ EOS
end
- ensure
- GC.stress = stress
end if GC.respond_to?(:stress=)
def test_configure_using_configure_and_merge