summaryrefslogtreecommitdiff
path: root/tests/json_encoding_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/json_encoding_test.rb')
-rw-r--r--tests/json_encoding_test.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/json_encoding_test.rb b/tests/json_encoding_test.rb
index f8b88d2..d983e12 100644
--- a/tests/json_encoding_test.rb
+++ b/tests/json_encoding_test.rb
@@ -5,9 +5,10 @@ class JSONEncodingTest < Test::Unit::TestCase
include JSON
def setup
- @utf_8 = '"© ≠ €!"'
- @parsed = "© ≠ €!"
- @generated = '"\u00a9 \u2260 \u20ac!"'
+ @utf_8 = '"© ≠ €!"'
+ @ascii_8bit = @utf_8.dup.force_encoding('ascii-8bit')
+ @parsed = "© ≠ €!"
+ @generated = '"\u00a9 \u2260 \u20ac!"'
if String.method_defined?(:encode)
@utf_16_data = @parsed.encode('utf-16be', 'utf-8')
@utf_16be = @utf_8.encode('utf-16be', 'utf-8')
@@ -25,6 +26,7 @@ class JSONEncodingTest < Test::Unit::TestCase
end
def test_parse
+ assert_equal @parsed, JSON.parse(@ascii_8bit)
assert_equal @parsed, JSON.parse(@utf_8)
assert_equal @parsed, JSON.parse(@utf_16be)
assert_equal @parsed, JSON.parse(@utf_16le)