Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a few tests with unicode strings

  • Loading branch information...
commit 0112d8835a45977aba8ee45e096f4d56b7fdb67d 1 parent 55deabd
@plentz plentz authored
View
8 test/compiler_test.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'test_helper'
require 'active_support/ordered_hash'
@@ -86,4 +88,10 @@ def test_adding_hash_objects
hash_test :garrett => true
end
end
+ def test_adding_generate_
+ json = JSONBuilder::Compiler.generate do
+ é "json"
+ end
+ assert_equal '{"é": "json"}', json
+ end
end
View
6 test/member_test.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'test_helper'
class TestMember < Test::Unit::TestCase
@@ -13,6 +15,10 @@ def test_key_as_symbol
assert_equal '"hello": true', member(:hello, true).to_s
end
+ def test_key_as_unicoded_symbol
+ assert_equal '"hellyé": true', member(:hellyé, true).to_s
+ end
+
def test_key_as_string
assert_equal '"hello": true', member('hello', true).to_s
end
View
6 test/value_test.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'test_helper'
class TestValue < Test::Unit::TestCase
@@ -37,6 +39,10 @@ def test_symbol_value
assert_equal 'test', value(:test)
end
+ def test_unicode_char_value
+ assert_equal '"hellyé"', value('hellyé')
+ end
+
def test_time_value
assert_equal '"2012-01-01T00:00:00Z"', value(Time.utc(2012))
end
Please sign in to comment.
Something went wrong with that request. Please try again.