json-jruby 1.4.1-universal-java-1.6 → 1.4.3-universal-java-1.6

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  module JSON
2
2
  # JSON version
3
- VERSION = '1.4.1'
3
+ VERSION = '1.4.3'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -173,7 +173,18 @@ class TC_JSON < Test::Unit::TestCase
173
173
  assert_equal({'foo'=>'bar'}, parse(' { "foo" : "bar" } '))
174
174
  end
175
175
 
176
- class SubHash < Hash; end
176
+ class SubHash < Hash
177
+ def to_json(*a)
178
+ {
179
+ JSON.create_id => self.class.name,
180
+ }.merge(self).to_json(*a)
181
+ end
182
+
183
+ def self.json_create(o)
184
+ o.delete JSON.create_id
185
+ new.merge(o)
186
+ end
187
+ end
177
188
 
178
189
  def test_parse_object_custom_class
179
190
  res = parse('{}', :object_class => SubHash)
@@ -181,6 +192,16 @@ class TC_JSON < Test::Unit::TestCase
181
192
  assert_equal(SubHash, res.class)
182
193
  end
183
194
 
195
+ def test_generation_of_core_subclasses
196
+ obj = SubHash.new.merge( "foo" => SubHash.new.merge("bar" => true))
197
+ obj_json = JSON(obj)
198
+ obj_again = JSON(obj_json)
199
+ assert_kind_of SubHash, obj_again
200
+ assert_kind_of SubHash, obj_again['foo']
201
+ assert obj_again['foo']['bar']
202
+ assert_equal obj, obj_again
203
+ end
204
+
184
205
  def test_parser_reset
185
206
  parser = Parser.new(@json)
186
207
  assert_equal(@hash, parser.parse)
@@ -151,12 +151,12 @@ class TC_JSONAddition < Test::Unit::TestCase
151
151
  def test_utc_datetime
152
152
  now = Time.now
153
153
  d = DateTime.parse(now.to_s) # usual case
154
- assert d, JSON.parse(d.to_json)
154
+ assert_equal d, JSON.parse(d.to_json)
155
155
  d = DateTime.parse(now.utc.to_s) # of = 0
156
- assert d, JSON.parse(d.to_json)
157
- d = DateTime.civil(2008, 6, 17, 11, 48, 32, 1) # of = 1 / 12 => 1/12
158
- assert d, JSON.parse(d.to_json)
159
- d = DateTime.civil(2008, 6, 17, 11, 48, 32, 12) # of = 12 / 12 => 12
160
- assert d, JSON.parse(d.to_json)
156
+ assert_equal d, JSON.parse(d.to_json)
157
+ d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(1,24))
158
+ assert_equal d, JSON.parse(d.to_json)
159
+ d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(12,24))
160
+ assert_equal d, JSON.parse(d.to_json)
161
161
  end
162
162
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 1
9
- version: 1.4.1
8
+ - 3
9
+ version: 1.4.3
10
10
  platform: universal-java-1.6
11
11
  authors:
12
12
  - Daniel Luz
@@ -14,12 +14,12 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-25 00:00:00 -03:00
17
+ date: 2010-05-06 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description:
22
- email: mernen+rubyforge@gmail.com
21
+ description: A JSON implementation as a JRuby extension.
22
+ email: dev+ruby@mernen.com
23
23
  executables: []
24
24
 
25
25
  extensions: []
@@ -78,7 +78,7 @@ files:
78
78
  - tests/fixtures/pass26.json
79
79
  - tests/fixtures/pass3.json
80
80
  has_rdoc: true
81
- homepage: http://rubyforge.org/projects/json-jruby/
81
+ homepage: http://json-jruby.rubyforge.org/
82
82
  licenses: []
83
83
 
84
84
  post_install_message:
@@ -106,6 +106,6 @@ rubyforge_project: json-jruby
106
106
  rubygems_version: 1.3.6
107
107
  signing_key:
108
108
  specification_version: 3
109
- summary: A JSON implementation as a JRuby extension
109
+ summary: JSON implementation for JRuby
110
110
  test_files: []
111
111