aboutsummaryrefslogtreecommitdiffstats
path: root/test/json/test_json_addition.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-01 17:34:50 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-01 17:34:50 +0000
commitd99ac4f829dd0903f20e02de5dbba0ddc175c1f3 (patch)
tree18f7c54ef29c879c9a3c342bcea594bde36ca2b5 /test/json/test_json_addition.rb
parent596b68cc6b6333a3939ebca3ae09fecc491e5718 (diff)
downloadruby-d99ac4f829dd0903f20e02de5dbba0ddc175c1f3.tar.gz
Add tests of JSON 1.1.9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json/test_json_addition.rb')
-rwxr-xr-xtest/json/test_json_addition.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/json/test_json_addition.rb b/test/json/test_json_addition.rb
index 2650db68f0..51e4a67f33 100755
--- a/test/json/test_json_addition.rb
+++ b/test/json/test_json_addition.rb
@@ -1,6 +1,12 @@
#!/usr/bin/env ruby
+# -*- coding:utf-8 -*-
require 'test/unit'
+case ENV['JSON']
+when 'pure' then require 'json/pure'
+when 'ext' then require 'json/ext'
+else require 'json'
+end
require 'json/add/core'
require 'date'
@@ -17,7 +23,7 @@ class TC_JSONAddition < Test::Unit::TestCase
def ==(other)
a == other.a
end
-
+
def self.json_create(object)
new(*object['args'])
end
@@ -89,11 +95,12 @@ class TC_JSONAddition < Test::Unit::TestCase
c = C.new
assert !C.json_creatable?
json = generate(c)
- assert_raise(ArgumentError) { JSON.parse(json) }
+ assert_raises(ArgumentError) { JSON.parse(json) }
end
def test_raw_strings
raw = ''
+ raw.respond_to?(:encode!) and raw.encode!(Encoding::ASCII_8BIT)
raw_array = []
for i in 0..255
raw << i
@@ -129,7 +136,7 @@ EOT
assert_equal s, JSON(JSON(s))
struct = Struct.new :foo, :bar
s = struct.new 4711, 'foot'
- assert_raise(JSONError) { JSON(s) }
+ assert_raises(JSONError) { JSON(s) }
begin
raise TypeError, "test me"
rescue TypeError => e