summaryrefslogtreecommitdiff
path: root/test/json/json_generator_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/json/json_generator_test.rb')
-rwxr-xr-xtest/json/json_generator_test.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 64042a4eaf..1bf4912ec7 100755
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -149,7 +149,7 @@ EOT
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
- :escape_slash => false,
+ :script_safe => false,
:indent => " ",
:max_nesting => 100,
:object_nl => "\n",
@@ -166,7 +166,7 @@ EOT
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
- :escape_slash => false,
+ :script_safe => false,
:indent => "",
:max_nesting => 100,
:object_nl => "",
@@ -183,7 +183,7 @@ EOT
:ascii_only => false,
:buffer_initial_length => 1024,
:depth => 0,
- :escape_slash => false,
+ :script_safe => false,
:indent => "",
:max_nesting => 0,
:object_nl => "",
@@ -370,6 +370,18 @@ EOT
#
data = [ '/' ]
json = '["\/"]'
+ assert_equal json, generate(data, :script_safe => true)
+ #
+ data = [ "\u2028\u2029" ]
+ json = '["\u2028\u2029"]'
+ assert_equal json, generate(data, :script_safe => true)
+ #
+ data = [ "ABC \u2028 DEF \u2029 GHI" ]
+ json = '["ABC \u2028 DEF \u2029 GHI"]'
+ assert_equal json, generate(data, :script_safe => true)
+ #
+ data = [ "/\u2028\u2029" ]
+ json = '["\/\u2028\u2029"]'
assert_equal json, generate(data, :escape_slash => true)
#
data = ['"']