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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35634d84fa9efd54d2c6a5c82572386ab76dcbd9
4
- data.tar.gz: b53f05e6cbb2159d88b800165e5e843bd0f8f10f
3
+ metadata.gz: ae9a5959e58d7693a350810b42cfc2f48237f9db
4
+ data.tar.gz: 71a1069996f76bdbffeb6f32100ae51c420f43ef
5
5
  SHA512:
6
- metadata.gz: 6a7fd255fb03915f2d5bef8d5d9093693a7544345b9dcc3a5208d26db2009b264797a1879e70e1d25e2144813d90e690cbab992092fc65fa0b7aaf22e93fa265
7
- data.tar.gz: 29166d47b6bdd0ef4fde76c532fd6227f163786ca1f9dd4b5f2a9f507658d078a8ef47ff25ffb59dfe98e5981f70a964e7b62c8703f246fa183f946d00ae115b
6
+ metadata.gz: 3aefcc5d370f348159091358e9728e5fff4e5c7a03bb6500bfd57e1e8f9033f66420a69f1750043e0bc1a3cdecb44e40593cb75aed1021d8799371934b1cea83
7
+ data.tar.gz: 04fd575199bdd4d23edf3cc3d473e2b970917728b55598f61cedf2d1d213b33fd8a324d93de7360490d29234b53f79784bdedc4b659612784a1b5bfa96cefb6f
@@ -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.");
@@ -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 :ascii.
1318
+ * :encoding to :unicode_xss.
1319
1319
  *
1320
1320
  * Returns [_Module_] the JSON module.
1321
1321
  */
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.1.2'
4
+ VERSION = '3.1.3'
5
5
  end
@@ -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
 
@@ -738,18 +738,21 @@ class Juice < Minitest::Test
738
738
  end
739
739
 
740
740
  def test_empty_string_true
741
- 10.times do
742
- result = Oj.load(gen_whitespaced_string, :empty_string => true)
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
- 10.times do
749
- assert_raises(Oj::ParseError) do
750
- Oj.load(gen_whitespaced_string, :empty_string => false)
751
- end
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.2
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-12 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler