oj 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/mimic_json.c +3 -1
- data/ext/oj/oj.c +2 -2
- data/lib/oj/version.rb +1 -1
- data/test/bug.rb +5 -1
- data/test/test_various.rb +11 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae9a5959e58d7693a350810b42cfc2f48237f9db
|
4
|
+
data.tar.gz: 71a1069996f76bdbffeb6f32100ae51c420f43ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aefcc5d370f348159091358e9728e5fff4e5c7a03bb6500bfd57e1e8f9033f66420a69f1750043e0bc1a3cdecb44e40593cb75aed1021d8799371934b1cea83
|
7
|
+
data.tar.gz: 04fd575199bdd4d23edf3cc3d473e2b970917728b55598f61cedf2d1d213b33fd8a324d93de7360490d29234b53f79784bdedc4b659612784a1b5bfa96cefb6f
|
data/ext/oj/mimic_json.c
CHANGED
@@ -200,7 +200,9 @@ mimic_dump(int argc, VALUE *argv, VALUE self) {
|
|
200
200
|
out.end = buf + sizeof(buf) - 10;
|
201
201
|
out.allocated = 0;
|
202
202
|
out.caller = CALLER_DUMP;
|
203
|
-
|
203
|
+
copts.escape_mode = JXEsc;
|
204
|
+
copts.mode = CompatMode;
|
205
|
+
|
204
206
|
/* seems like this is not correct
|
205
207
|
if (No == copts.nilnil && Qnil == *argv) {
|
206
208
|
rb_raise(rb_eTypeError, "nil not allowed.");
|
data/ext/oj/oj.c
CHANGED
@@ -274,7 +274,7 @@ get_def_opts(VALUE self) {
|
|
274
274
|
case StrictMode: rb_hash_aset(opts, mode_sym, strict_sym); break;
|
275
275
|
case CompatMode: rb_hash_aset(opts, mode_sym, compat_sym); break;
|
276
276
|
case NullMode: rb_hash_aset(opts, mode_sym, null_sym); break;
|
277
|
-
case ObjectMode:
|
277
|
+
case ObjectMode: rb_hash_aset(opts, mode_sym, object_sym); break;
|
278
278
|
case CustomMode: rb_hash_aset(opts, mode_sym, custom_sym); break;
|
279
279
|
case RailsMode: rb_hash_aset(opts, mode_sym, rails_sym); break;
|
280
280
|
default: rb_hash_aset(opts, mode_sym, object_sym); break;
|
@@ -1315,7 +1315,7 @@ extern VALUE oj_remove_to_json(int argc, VALUE *argv, VALUE self);
|
|
1315
1315
|
* will be replaced with Oj methods.
|
1316
1316
|
*
|
1317
1317
|
* Note that this also sets the default options of :mode to :compat and
|
1318
|
-
* :encoding to :
|
1318
|
+
* :encoding to :unicode_xss.
|
1319
1319
|
*
|
1320
1320
|
* Returns [_Module_] the JSON module.
|
1321
1321
|
*/
|
data/lib/oj/version.rb
CHANGED
data/test/bug.rb
CHANGED
@@ -9,7 +9,11 @@ require 'rails'
|
|
9
9
|
require 'active_support/json'
|
10
10
|
require 'oj'
|
11
11
|
|
12
|
+
puts Oj.default_options[:mode]
|
13
|
+
puts Oj.dump({1=>'a',2=>'b'})
|
14
|
+
|
12
15
|
Oj.optimize_rails
|
13
16
|
|
14
|
-
JSON.pretty_generate({'a'=>1,'b'=>[true,false]})
|
17
|
+
puts JSON.pretty_generate({'a'=>1,'b'=>[true,false]})
|
18
|
+
puts JSON.dump({1=>'a',2=>'b'})
|
15
19
|
|
data/test/test_various.rb
CHANGED
@@ -738,18 +738,21 @@ class Juice < Minitest::Test
|
|
738
738
|
end
|
739
739
|
|
740
740
|
def test_empty_string_true
|
741
|
-
|
742
|
-
|
743
|
-
assert_nil(result)
|
744
|
-
end
|
741
|
+
result = Oj.load(gen_whitespaced_string, :empty_string => true)
|
742
|
+
assert_nil(result)
|
745
743
|
end
|
746
744
|
|
747
745
|
def test_empty_string_false
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
746
|
+
# Could be either a Oj::ParseError or an EncodingError depending on
|
747
|
+
# whether mimic_JSON has been called. Since we don't know when the test
|
748
|
+
# will be called either is okay.
|
749
|
+
begin
|
750
|
+
Oj.load(gen_whitespaced_string, :empty_string => false)
|
751
|
+
rescue Exception => e
|
752
|
+
assert(Oj::ParseError == e.class || EncodingError == e.class)
|
753
|
+
return
|
752
754
|
end
|
755
|
+
assert(false, "*** expected an exception")
|
753
756
|
end
|
754
757
|
|
755
758
|
def test_quirks_null_mode
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|