summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/psych/extconf.rb2
-rw-r--r--ext/psych/lib/psych.rb8
-rw-r--r--ext/psych/lib/psych/class_loader.rb2
-rw-r--r--ext/psych/lib/psych/coder.rb2
-rw-r--r--ext/psych/lib/psych/core_ext.rb2
-rw-r--r--ext/psych/lib/psych/exception.rb2
-rw-r--r--ext/psych/lib/psych/handler.rb2
-rw-r--r--ext/psych/lib/psych/handlers/document_stream.rb2
-rw-r--r--ext/psych/lib/psych/handlers/recorder.rb2
-rw-r--r--ext/psych/lib/psych/json/ruby_events.rb2
-rw-r--r--ext/psych/lib/psych/json/stream.rb2
-rw-r--r--ext/psych/lib/psych/json/tree_builder.rb2
-rw-r--r--ext/psych/lib/psych/json/yaml_events.rb2
-rw-r--r--ext/psych/lib/psych/nodes.rb2
-rw-r--r--ext/psych/lib/psych/nodes/alias.rb2
-rw-r--r--ext/psych/lib/psych/nodes/document.rb2
-rw-r--r--ext/psych/lib/psych/nodes/mapping.rb2
-rw-r--r--ext/psych/lib/psych/nodes/node.rb2
-rw-r--r--ext/psych/lib/psych/nodes/scalar.rb2
-rw-r--r--ext/psych/lib/psych/nodes/sequence.rb2
-rw-r--r--ext/psych/lib/psych/nodes/stream.rb2
-rw-r--r--ext/psych/lib/psych/omap.rb2
-rw-r--r--ext/psych/lib/psych/parser.rb2
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb2
-rw-r--r--ext/psych/lib/psych/set.rb2
-rw-r--r--ext/psych/lib/psych/stream.rb2
-rw-r--r--ext/psych/lib/psych/streaming.rb2
-rw-r--r--ext/psych/lib/psych/syntax_error.rb2
-rw-r--r--ext/psych/lib/psych/tree_builder.rb2
-rw-r--r--ext/psych/lib/psych/versions.rb2
-rw-r--r--ext/psych/lib/psych/visitors.rb2
-rw-r--r--ext/psych/lib/psych/visitors/depth_first.rb2
-rw-r--r--ext/psych/lib/psych/visitors/emitter.rb2
-rw-r--r--ext/psych/lib/psych/visitors/json_tree.rb2
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb2
-rw-r--r--ext/psych/lib/psych/visitors/visitor.rb2
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb22
-rw-r--r--ext/psych/lib/psych/y.rb2
-rw-r--r--ext/psych/psych.gemspec27
-rw-r--r--test/psych/handlers/test_recorder.rb2
-rw-r--r--test/psych/helper.rb2
-rw-r--r--test/psych/json/test_stream.rb2
-rw-r--r--test/psych/nodes/test_enumerable.rb2
-rw-r--r--test/psych/test_alias_and_anchor.rb2
-rw-r--r--test/psych/test_array.rb8
-rw-r--r--test/psych/test_boolean.rb2
-rw-r--r--test/psych/test_class.rb2
-rw-r--r--test/psych/test_coder.rb2
-rw-r--r--test/psych/test_date_time.rb2
-rw-r--r--test/psych/test_deprecated.rb2
-rw-r--r--test/psych/test_document.rb2
-rw-r--r--test/psych/test_emitter.rb4
-rw-r--r--test/psych/test_encoding.rb2
-rw-r--r--test/psych/test_exception.rb2
-rw-r--r--test/psych/test_hash.rb2
-rw-r--r--test/psych/test_json_tree.rb2
-rw-r--r--test/psych/test_marshalable.rb2
-rw-r--r--test/psych/test_merge_keys.rb2
-rw-r--r--test/psych/test_nil.rb2
-rw-r--r--test/psych/test_null.rb2
-rw-r--r--test/psych/test_numeric.rb2
-rw-r--r--test/psych/test_object.rb2
-rw-r--r--test/psych/test_object_references.rb2
-rw-r--r--test/psych/test_omap.rb2
-rw-r--r--test/psych/test_parser.rb2
-rw-r--r--test/psych/test_psych.rb4
-rw-r--r--test/psych/test_safe_load.rb2
-rw-r--r--test/psych/test_scalar.rb7
-rw-r--r--test/psych/test_scalar_scanner.rb2
-rw-r--r--test/psych/test_serialize_subclasses.rb2
-rw-r--r--test/psych/test_set.rb2
-rw-r--r--test/psych/test_stream.rb2
-rw-r--r--test/psych/test_string.rb16
-rw-r--r--test/psych/test_struct.rb2
-rw-r--r--test/psych/test_symbol.rb2
-rw-r--r--test/psych/test_tainted.rb4
-rw-r--r--test/psych/test_tree_builder.rb2
-rw-r--r--test/psych/test_yaml.rb2
-rw-r--r--test/psych/test_yamldbm.rb2
-rw-r--r--test/psych/test_yamlstore.rb2
-rw-r--r--test/psych/visitors/test_depth_first.rb2
-rw-r--r--test/psych/visitors/test_emitter.rb2
-rw-r--r--test/psych/visitors/test_to_ruby.rb2
-rw-r--r--test/psych/visitors/test_yaml_tree.rb4
84 files changed, 144 insertions, 108 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index be33d35a5ed..6d8390ebe5b 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,5 +1,5 @@
# -*- coding: us-ascii -*-
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'mkmf'
require 'fileutils'
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index 9959320a7fc..e93ac8f4060 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -1,11 +1,15 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/versions'
case RUBY_ENGINE
when 'jruby'
require 'psych_jars'
org.jruby.ext.psych.PsychLibrary.new.load(JRuby.runtime, false)
else
- require 'psych.so'
+ begin
+ require "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"
+ rescue LoadError
+ require 'psych.so'
+ end
end
require 'psych/nodes'
require 'psych/streaming'
diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb
index ba756f7ea77..cfca86845a6 100644
--- a/ext/psych/lib/psych/class_loader.rb
+++ b/ext/psych/lib/psych/class_loader.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/omap'
require 'psych/set'
diff --git a/ext/psych/lib/psych/coder.rb b/ext/psych/lib/psych/coder.rb
index 26005f57b41..96a9c3fbad5 100644
--- a/ext/psych/lib/psych/coder.rb
+++ b/ext/psych/lib/psych/coder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
###
# If an object defines +encode_with+, then an instance of Psych::Coder will
diff --git a/ext/psych/lib/psych/core_ext.rb b/ext/psych/lib/psych/core_ext.rb
index 1232abf3d91..81055cc5016 100644
--- a/ext/psych/lib/psych/core_ext.rb
+++ b/ext/psych/lib/psych/core_ext.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
class Object
def self.yaml_tag url
Psych.add_tag(url, self)
diff --git a/ext/psych/lib/psych/exception.rb b/ext/psych/lib/psych/exception.rb
index 83c3d7fa82d..fac0c42b9fb 100644
--- a/ext/psych/lib/psych/exception.rb
+++ b/ext/psych/lib/psych/exception.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
class Exception < RuntimeError
end
diff --git a/ext/psych/lib/psych/handler.rb b/ext/psych/lib/psych/handler.rb
index 1ab5f73e95b..1074c18f9e0 100644
--- a/ext/psych/lib/psych/handler.rb
+++ b/ext/psych/lib/psych/handler.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
###
# Psych::Handler is an abstract base class that defines the events used
diff --git a/ext/psych/lib/psych/handlers/document_stream.rb b/ext/psych/lib/psych/handlers/document_stream.rb
index c43b39ebc58..67da794093a 100644
--- a/ext/psych/lib/psych/handlers/document_stream.rb
+++ b/ext/psych/lib/psych/handlers/document_stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/tree_builder'
module Psych
diff --git a/ext/psych/lib/psych/handlers/recorder.rb b/ext/psych/lib/psych/handlers/recorder.rb
index 341b81dec4d..a8fc7b11444 100644
--- a/ext/psych/lib/psych/handlers/recorder.rb
+++ b/ext/psych/lib/psych/handlers/recorder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/handler'
module Psych
diff --git a/ext/psych/lib/psych/json/ruby_events.rb b/ext/psych/lib/psych/json/ruby_events.rb
index 478eb667c72..17b7ddc386b 100644
--- a/ext/psych/lib/psych/json/ruby_events.rb
+++ b/ext/psych/lib/psych/json/ruby_events.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module JSON
module RubyEvents # :nodoc:
diff --git a/ext/psych/lib/psych/json/stream.rb b/ext/psych/lib/psych/json/stream.rb
index 83b7e136552..2ebd3d7a66f 100644
--- a/ext/psych/lib/psych/json/stream.rb
+++ b/ext/psych/lib/psych/json/stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/json/ruby_events'
require 'psych/json/yaml_events'
diff --git a/ext/psych/lib/psych/json/tree_builder.rb b/ext/psych/lib/psych/json/tree_builder.rb
index 2f94b8c2527..5c2ee8ca25a 100644
--- a/ext/psych/lib/psych/json/tree_builder.rb
+++ b/ext/psych/lib/psych/json/tree_builder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/json/yaml_events'
module Psych
diff --git a/ext/psych/lib/psych/json/yaml_events.rb b/ext/psych/lib/psych/json/yaml_events.rb
index 07f64737c54..eb973f53618 100644
--- a/ext/psych/lib/psych/json/yaml_events.rb
+++ b/ext/psych/lib/psych/json/yaml_events.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module JSON
module YAMLEvents # :nodoc:
diff --git a/ext/psych/lib/psych/nodes.rb b/ext/psych/lib/psych/nodes.rb
index 01573b509bf..5842c2e3e56 100644
--- a/ext/psych/lib/psych/nodes.rb
+++ b/ext/psych/lib/psych/nodes.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/nodes/node'
require 'psych/nodes/stream'
require 'psych/nodes/document'
diff --git a/ext/psych/lib/psych/nodes/alias.rb b/ext/psych/lib/psych/nodes/alias.rb
index 716a00d62f5..8131a4befbf 100644
--- a/ext/psych/lib/psych/nodes/alias.rb
+++ b/ext/psych/lib/psych/nodes/alias.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/document.rb b/ext/psych/lib/psych/nodes/document.rb
index 7234fef1d8d..3cd418eaf37 100644
--- a/ext/psych/lib/psych/nodes/document.rb
+++ b/ext/psych/lib/psych/nodes/document.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/mapping.rb b/ext/psych/lib/psych/nodes/mapping.rb
index 4c11df8cd61..b921ddc862f 100644
--- a/ext/psych/lib/psych/nodes/mapping.rb
+++ b/ext/psych/lib/psych/nodes/mapping.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/node.rb b/ext/psych/lib/psych/nodes/node.rb
index e3621dc4511..1c7672164d3 100644
--- a/ext/psych/lib/psych/nodes/node.rb
+++ b/ext/psych/lib/psych/nodes/node.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'stringio'
require 'psych/class_loader'
require 'psych/scalar_scanner'
diff --git a/ext/psych/lib/psych/nodes/scalar.rb b/ext/psych/lib/psych/nodes/scalar.rb
index ee5570518e3..b4488588317 100644
--- a/ext/psych/lib/psych/nodes/scalar.rb
+++ b/ext/psych/lib/psych/nodes/scalar.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/sequence.rb b/ext/psych/lib/psych/nodes/sequence.rb
index 1096469567d..77c2c602b9a 100644
--- a/ext/psych/lib/psych/nodes/sequence.rb
+++ b/ext/psych/lib/psych/nodes/sequence.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/nodes/stream.rb b/ext/psych/lib/psych/nodes/stream.rb
index 559b0846e7c..2474fe62c44 100644
--- a/ext/psych/lib/psych/nodes/stream.rb
+++ b/ext/psych/lib/psych/nodes/stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Nodes
###
diff --git a/ext/psych/lib/psych/omap.rb b/ext/psych/lib/psych/omap.rb
index 233b945c4a3..29cde0be501 100644
--- a/ext/psych/lib/psych/omap.rb
+++ b/ext/psych/lib/psych/omap.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
class Omap < ::Hash
end
diff --git a/ext/psych/lib/psych/parser.rb b/ext/psych/lib/psych/parser.rb
index 242512f89f1..39bc8289be7 100644
--- a/ext/psych/lib/psych/parser.rb
+++ b/ext/psych/lib/psych/parser.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
###
# YAML event parser class. This class parses a YAML document and calls
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index 67c0cc3d4e7..29c156c212f 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'strscan'
module Psych
diff --git a/ext/psych/lib/psych/set.rb b/ext/psych/lib/psych/set.rb
index f35be15e6f9..760d2170981 100644
--- a/ext/psych/lib/psych/set.rb
+++ b/ext/psych/lib/psych/set.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
class Set < ::Hash
end
diff --git a/ext/psych/lib/psych/stream.rb b/ext/psych/lib/psych/stream.rb
index 2f63d7d552b..24e45afc3b4 100644
--- a/ext/psych/lib/psych/stream.rb
+++ b/ext/psych/lib/psych/stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
###
# Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
diff --git a/ext/psych/lib/psych/streaming.rb b/ext/psych/lib/psych/streaming.rb
index 260f8a80083..eb19792ad0d 100644
--- a/ext/psych/lib/psych/streaming.rb
+++ b/ext/psych/lib/psych/streaming.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Streaming
module ClassMethods
diff --git a/ext/psych/lib/psych/syntax_error.rb b/ext/psych/lib/psych/syntax_error.rb
index db293b9fb28..1598e6ff368 100644
--- a/ext/psych/lib/psych/syntax_error.rb
+++ b/ext/psych/lib/psych/syntax_error.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/exception'
module Psych
diff --git a/ext/psych/lib/psych/tree_builder.rb b/ext/psych/lib/psych/tree_builder.rb
index d359c933af7..b10fd5c5cdb 100644
--- a/ext/psych/lib/psych/tree_builder.rb
+++ b/ext/psych/lib/psych/tree_builder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/handler'
module Psych
diff --git a/ext/psych/lib/psych/versions.rb b/ext/psych/lib/psych/versions.rb
index 3d61c8b015d..49f8820246a 100644
--- a/ext/psych/lib/psych/versions.rb
+++ b/ext/psych/lib/psych/versions.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
# The version is Psych you're using
VERSION = '3.0.0.beta2'
diff --git a/ext/psych/lib/psych/visitors.rb b/ext/psych/lib/psych/visitors.rb
index 5dee4ebd7af..e2b084daeee 100644
--- a/ext/psych/lib/psych/visitors.rb
+++ b/ext/psych/lib/psych/visitors.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/visitors/visitor'
require 'psych/visitors/to_ruby'
require 'psych/visitors/emitter'
diff --git a/ext/psych/lib/psych/visitors/depth_first.rb b/ext/psych/lib/psych/visitors/depth_first.rb
index 2d74a212d6b..b4ff9e40e7f 100644
--- a/ext/psych/lib/psych/visitors/depth_first.rb
+++ b/ext/psych/lib/psych/visitors/depth_first.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Visitors
class DepthFirst < Psych::Visitors::Visitor
diff --git a/ext/psych/lib/psych/visitors/emitter.rb b/ext/psych/lib/psych/visitors/emitter.rb
index f2ff9fdb28b..e3b92b7d036 100644
--- a/ext/psych/lib/psych/visitors/emitter.rb
+++ b/ext/psych/lib/psych/visitors/emitter.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Visitors
class Emitter < Psych::Visitors::Visitor
diff --git a/ext/psych/lib/psych/visitors/json_tree.rb b/ext/psych/lib/psych/visitors/json_tree.rb
index f2f0215cd22..9912cb13621 100644
--- a/ext/psych/lib/psych/visitors/json_tree.rb
+++ b/ext/psych/lib/psych/visitors/json_tree.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/json/ruby_events'
module Psych
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index d1318b3ca03..74a52df8665 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/scalar_scanner'
require 'psych/class_loader'
require 'psych/exception'
diff --git a/ext/psych/lib/psych/visitors/visitor.rb b/ext/psych/lib/psych/visitors/visitor.rb
index d97bf550f69..3f4ba64e57d 100644
--- a/ext/psych/lib/psych/visitors/visitor.rb
+++ b/ext/psych/lib/psych/visitors/visitor.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Psych
module Visitors
class Visitor
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index e197a306110..cfed8f1814a 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/tree_builder'
require 'psych/scalar_scanner'
require 'psych/class_loader'
@@ -321,7 +321,7 @@ module Psych
end
@emitter.scalar o, nil, tag, plain, quote, style
else
- maptag = '!ruby/string'
+ maptag = '!ruby/string'.dup
maptag << ":#{o.class}" unless o.class == ::String
register o, @emitter.start_mapping(nil, maptag, false, Nodes::Mapping::BLOCK)
@@ -378,14 +378,18 @@ module Psych
def visit_Array o
if o.class == ::Array
- register o, @emitter.start_sequence(nil, nil, true, Nodes::Sequence::BLOCK)
- o.each { |c| accept c }
- @emitter.end_sequence
+ visit_Enumerator o
else
visit_array_subclass o
end
end
+ def visit_Enumerator o
+ register o, @emitter.start_sequence(nil, nil, true, Nodes::Sequence::BLOCK)
+ o.each { |c| accept c }
+ @emitter.end_sequence
+ end
+
def visit_NilClass o
@emitter.scalar('', nil, 'tag:yaml.org,2002:null', true, false, Nodes::Scalar::ANY)
end
@@ -411,15 +415,9 @@ module Psych
end
private
- # FIXME: Remove the index and count checks in Psych 3.0
- NULL = "\x00"
- BINARY_RANGE = "\x00-\x7F"
- WS_RANGE = "^ -~\t\r\n"
def binary? string
- (string.encoding == Encoding::ASCII_8BIT && !string.ascii_only?) ||
- string.index(NULL) ||
- string.count(BINARY_RANGE, WS_RANGE).fdiv(string.length) > 0.3
+ string.encoding == Encoding::ASCII_8BIT && !string.ascii_only?
end
def visit_array_subclass o
diff --git a/ext/psych/lib/psych/y.rb b/ext/psych/lib/psych/y.rb
index 82e05a783c3..e857953c047 100644
--- a/ext/psych/lib/psych/y.rb
+++ b/ext/psych/lib/psych/y.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Kernel
###
# An alias for Psych.dump_stream meant to be used with IRB.
diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec
index c0ec5c53347..06073735dde 100644
--- a/ext/psych/psych.gemspec
+++ b/ext/psych/psych.gemspec
@@ -1,4 +1,5 @@
# -*- encoding: utf-8 -*-
+# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "psych"
@@ -17,7 +18,25 @@ DESCRIPTION
s.require_paths = ["lib"]
# for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec"]
+ s.files = [
+ ".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console",
+ "bin/setup", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h",
+ "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h",
+ "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h",
+ "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c",
+ "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c",
+ "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h",
+ "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/exception.rb",
+ "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb",
+ "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb",
+ "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb",
+ "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb",
+ "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb",
+ "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb",
+ "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb",
+ "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb",
+ "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec"
+ ]
s.rdoc_options = ["--main", "README.md"]
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md"]
@@ -31,11 +50,15 @@ DESCRIPTION
if RUBY_ENGINE == 'jruby'
s.platform = 'java'
- s.files.concat ["ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java", "ext/java/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar"]
+ s.files.concat [
+ "ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java",
+ "ext/java/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar"
+ ]
s.requirements = "jar org.yaml:snakeyaml, 1.18"
s.add_dependency 'jar-dependencies', '>= 0.1.7'
s.add_development_dependency 'ruby-maven'
else
s.extensions = ["ext/psych/extconf.rb"]
+ s.add_development_dependency 'rake-compiler-dock', ">= 0.6.1"
end
end
diff --git a/test/psych/handlers/test_recorder.rb b/test/psych/handlers/test_recorder.rb
index 17c7c6d0a02..d9d379ea9aa 100644
--- a/test/psych/handlers/test_recorder.rb
+++ b/test/psych/handlers/test_recorder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
require 'psych/handlers/recorder'
diff --git a/test/psych/helper.rb b/test/psych/helper.rb
index 7b564bd2d7e..93484579584 100644
--- a/test/psych/helper.rb
+++ b/test/psych/helper.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'minitest/autorun'
require 'stringio'
require 'tempfile'
diff --git a/test/psych/json/test_stream.rb b/test/psych/json/test_stream.rb
index 519c114b293..90a770c1b78 100644
--- a/test/psych/json/test_stream.rb
+++ b/test/psych/json/test_stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/nodes/test_enumerable.rb b/test/psych/nodes/test_enumerable.rb
index 2f4e1f3bd0f..76b36856f1a 100644
--- a/test/psych/nodes/test_enumerable.rb
+++ b/test/psych/nodes/test_enumerable.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/test_alias_and_anchor.rb b/test/psych/test_alias_and_anchor.rb
index ed009605ca4..91c09dfdfa9 100644
--- a/test/psych/test_alias_and_anchor.rb
+++ b/test/psych/test_alias_and_anchor.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
class ObjectWithInstanceVariables
diff --git a/test/psych/test_array.rb b/test/psych/test_array.rb
index 6306a049fc5..f2bbdcab884 100644
--- a/test/psych/test_array.rb
+++ b/test/psych/test_array.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
@@ -15,6 +15,12 @@ module Psych
@list = [{ :a => 'b' }, 'foo']
end
+ def test_enumerator
+ x = [1, 2, 3, 4]
+ y = Psych.load Psych.dump x.to_enum
+ assert_equal x, y
+ end
+
def test_another_subclass_with_attributes
y = Y.new.tap {|o| o.val = 1}
y << "foo" << "bar"
diff --git a/test/psych/test_boolean.rb b/test/psych/test_boolean.rb
index b2803a65502..a4b80fc13d1 100644
--- a/test/psych/test_boolean.rb
+++ b/test/psych/test_boolean.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_class.rb b/test/psych/test_class.rb
index 4e1fd4a1d69..71f7ec31fd1 100644
--- a/test/psych/test_class.rb
+++ b/test/psych/test_class.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb
index e578d55f2d0..5ea8cab9661 100644
--- a/test/psych/test_coder.rb
+++ b/test/psych/test_coder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index 3c8b4360988..f73f34628fd 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'date'
diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb
index eab230231df..624f4379a60 100644
--- a/test/psych/test_deprecated.rb
+++ b/test/psych/test_deprecated.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_document.rb b/test/psych/test_document.rb
index 97de2e15ec3..a88dd32f0d0 100644
--- a/test/psych/test_document.rb
+++ b/test/psych/test_document.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_emitter.rb b/test/psych/test_emitter.rb
index 23e68b324e7..52d5e9d1c11 100644
--- a/test/psych/test_emitter.rb
+++ b/test/psych/test_emitter.rb
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
@@ -7,7 +7,7 @@ module Psych
class TestEmitter < TestCase
def setup
super
- @out = StringIO.new('')
+ @out = StringIO.new(''.dup)
@emitter = Psych::Emitter.new @out
end
diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb
index 13ca5dbc741..a4f9f036fd3 100644
--- a/test/psych/test_encoding.rb
+++ b/test/psych/test_encoding.rb
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index fa80fdbeb29..3040bfb7a2e 100644
--- a/test/psych/test_exception.rb
+++ b/test/psych/test_exception.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb
index b449ce49e37..e93aa732498 100644
--- a/test/psych/test_hash.rb
+++ b/test/psych/test_hash.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_json_tree.rb b/test/psych/test_json_tree.rb
index 8bb850b1388..3c59a8dbda9 100644
--- a/test/psych/test_json_tree.rb
+++ b/test/psych/test_json_tree.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_marshalable.rb b/test/psych/test_marshalable.rb
index 544947a521b..b1f4a837f58 100644
--- a/test/psych/test_marshalable.rb
+++ b/test/psych/test_marshalable.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'delegate'
diff --git a/test/psych/test_merge_keys.rb b/test/psych/test_merge_keys.rb
index 76245ca7b53..1bc3dd1cb6c 100644
--- a/test/psych/test_merge_keys.rb
+++ b/test/psych/test_merge_keys.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb
index 3d4fa88eaa4..910a2e697de 100644
--- a/test/psych/test_nil.rb
+++ b/test/psych/test_nil.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_null.rb b/test/psych/test_null.rb
index d8ccb7056fd..9d92d74150d 100644
--- a/test/psych/test_null.rb
+++ b/test/psych/test_null.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb
index 9d8b74f7caa..db99a2a0d6e 100644
--- a/test/psych/test_numeric.rb
+++ b/test/psych/test_numeric.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'bigdecimal'
diff --git a/test/psych/test_object.rb b/test/psych/test_object.rb
index ed1ccd9bf89..f1c61451d08 100644
--- a/test/psych/test_object.rb
+++ b/test/psych/test_object.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_object_references.rb b/test/psych/test_object_references.rb
index 1300bfc1db5..ca69c7d288c 100644
--- a/test/psych/test_object_references.rb
+++ b/test/psych/test_object_references.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_omap.rb b/test/psych/test_omap.rb
index 80791aa9187..98636ded978 100644
--- a/test/psych/test_omap.rb
+++ b/test/psych/test_omap.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb
index 26aba0543b9..6b554cedf01 100644
--- a/test/psych/test_parser.rb
+++ b/test/psych/test_parser.rb
@@ -1,5 +1,5 @@
# coding: utf-8
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 24030d55bc2..d0de95627ea 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'stringio'
@@ -84,7 +84,7 @@ class TestPsych < Psych::TestCase
def test_dump_io
hash = {'hello' => 'TGIF!'}
- stringio = StringIO.new ''
+ stringio = StringIO.new ''.dup
assert_equal stringio, Psych.dump(hash, stringio)
assert_equal Psych.dump(hash), stringio.string
end
diff --git a/test/psych/test_safe_load.rb b/test/psych/test_safe_load.rb
index b69c54c1999..f3fdb9b9a22 100644
--- a/test/psych/test_safe_load.rb
+++ b/test/psych/test_safe_load.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/test_scalar.rb b/test/psych/test_scalar.rb
index 4353ec33fa7..e2f9ec791d6 100644
--- a/test/psych/test_scalar.rb
+++ b/test/psych/test_scalar.rb
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
@@ -8,5 +8,10 @@ module Psych
def test_utf_8
assert_equal "日本語", Psych.load("--- 日本語")
end
+
+ def test_some_bytes # Ticket #278
+ x = "\xEF\xBF\xBD\x1F"
+ assert_cycle x
+ end
end
end
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index e51fc69c4a6..ebe8daf6727 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'date'
diff --git a/test/psych/test_serialize_subclasses.rb b/test/psych/test_serialize_subclasses.rb
index be209edf2f3..8e1d0d354dd 100644
--- a/test/psych/test_serialize_subclasses.rb
+++ b/test/psych/test_serialize_subclasses.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_set.rb b/test/psych/test_set.rb
index 0eb999cb2f0..5690957effa 100644
--- a/test/psych/test_set.rb
+++ b/test/psych/test_set.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_stream.rb b/test/psych/test_stream.rb
index 1b054289eab..3bd557cb68c 100644
--- a/test/psych/test_stream.rb
+++ b/test/psych/test_stream.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index 4aa6016a598..973f38b9c27 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -1,5 +1,5 @@
# encoding: UTF-8
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
@@ -166,7 +166,7 @@ string: &70121654388580 !ruby/string
end
def test_nonascii_string_as_binary
- string = "hello \x80 world!"
+ string = "hello \x80 world!".dup
string.force_encoding 'ascii-8bit'
yml = Psych.dump string
assert_match(/binary/, yml)
@@ -174,7 +174,7 @@ string: &70121654388580 !ruby/string
end
def test_binary_string_null
- string = "\x00"
+ string = "\x00\x92".b
yml = Psych.dump string
assert_match(/binary/, yml)
assert_equal string, Psych.load(yml)
@@ -187,8 +187,8 @@ string: &70121654388580 !ruby/string
assert_equal string, Psych.load(yml)
end
- def test_non_binary_string
- string = binary_string(0.29)
+ def test_ascii_only_binary_string
+ string = "non bnry string".b
yml = Psych.dump string
refute_match(/binary/, yml)
assert_equal string, Psych.load(yml)
@@ -202,7 +202,7 @@ string: &70121654388580 !ruby/string
end
def test_string_with_ivars
- food = "is delicious"
+ food = "is delicious".dup
ivar = "on rock and roll"
food.instance_variable_set(:@we_built_this_city, ivar)
@@ -220,9 +220,9 @@ string: &70121654388580 !ruby/string
end
def binary_string percentage = 0.31, length = 100
- string = ''
+ string = ''.b
(percentage * length).to_i.times do |i|
- string << "\b"
+ string << "\x92".b
end
string << 'a' * (length - string.length)
string
diff --git a/test/psych/test_struct.rb b/test/psych/test_struct.rb
index b7968d31890..721df44216b 100644
--- a/test/psych/test_struct.rb
+++ b/test/psych/test_struct.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
class PsychStructWithIvar < Struct.new(:foo)
diff --git a/test/psych/test_symbol.rb b/test/psych/test_symbol.rb
index a98881cf4b6..36416ffe293 100644
--- a/test/psych/test_symbol.rb
+++ b/test/psych/test_symbol.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_tainted.rb b/test/psych/test_tainted.rb
index 870583323dd..dcf150b138e 100644
--- a/test/psych/test_tainted.rb
+++ b/test/psych/test_tainted.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
@@ -90,7 +90,7 @@ module Psych
end
def assert_taintedness string
- @parser.parse string.taint
+ @parser.parse string.dup.taint
end
end
diff --git a/test/psych/test_tree_builder.rb b/test/psych/test_tree_builder.rb
index 09f1ee30c99..3e35788e35c 100644
--- a/test/psych/test_tree_builder.rb
+++ b/test/psych/test_tree_builder.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
module Psych
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index cfba770ee1e..5fa759c981b 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -1,5 +1,5 @@
# -*- coding: us-ascii; mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
-# frozen_string_literal: false
+# frozen_string_literal: true
# vim:sw=4:ts=4
# $Id$
#
diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb
index 71ee04f8631..1f9ba15cde1 100644
--- a/test/psych/test_yamldbm.rb
+++ b/test/psych/test_yamldbm.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'tmpdir'
diff --git a/test/psych/test_yamlstore.rb b/test/psych/test_yamlstore.rb
index a9ce652ced3..d1e927cefe0 100644
--- a/test/psych/test_yamlstore.rb
+++ b/test/psych/test_yamlstore.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require_relative 'helper'
require 'yaml/store'
require 'tmpdir'
diff --git a/test/psych/visitors/test_depth_first.rb b/test/psych/visitors/test_depth_first.rb
index 8072c26b579..f8305e15ecc 100644
--- a/test/psych/visitors/test_depth_first.rb
+++ b/test/psych/visitors/test_depth_first.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/visitors/test_emitter.rb b/test/psych/visitors/test_emitter.rb
index 9317855bbb3..70adbb9ca0a 100644
--- a/test/psych/visitors/test_emitter.rb
+++ b/test/psych/visitors/test_emitter.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 8878ea22b24..f342bf0a1a0 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -1,5 +1,5 @@
# coding: US-ASCII
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb
index 8fc18f2fe66..01f1aecd086 100644
--- a/test/psych/visitors/test_yaml_tree.rb
+++ b/test/psych/visitors/test_yaml_tree.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'psych/helper'
module Psych
@@ -37,7 +37,7 @@ module Psych
end
def test_binary_formatting
- gif = "GIF89a\f\x00\f\x00\x84\x00\x00\xFF\xFF\xF7\xF5\xF5\xEE\xE9\xE9\xE5fff\x00\x00\x00\xE7\xE7\xE7^^^\xF3\xF3\xED\x8E\x8E\x8E\xE0\xE0\xE0\x9F\x9F\x9F\x93\x93\x93\xA7\xA7\xA7\x9E\x9E\x9Eiiiccc\xA3\xA3\xA3\x84\x84\x84\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9!\xFE\x0EMade with GIMP\x00,\x00\x00\x00\x00\f\x00\f\x00\x00\x05, \x8E\x810\x9E\xE3@\x14\xE8i\x10\xC4\xD1\x8A\b\x1C\xCF\x80M$z\xEF\xFF0\x85p\xB8\xB01f\r\e\xCE\x01\xC3\x01\x1E\x10' \x82\n\x01\x00;"
+ gif = "GIF89a\f\x00\f\x00\x84\x00\x00\xFF\xFF\xF7\xF5\xF5\xEE\xE9\xE9\xE5fff\x00\x00\x00\xE7\xE7\xE7^^^\xF3\xF3\xED\x8E\x8E\x8E\xE0\xE0\xE0\x9F\x9F\x9F\x93\x93\x93\xA7\xA7\xA7\x9E\x9E\x9Eiiiccc\xA3\xA3\xA3\x84\x84\x84\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9\xFF\xFE\xF9!\xFE\x0EMade with GIMP\x00,\x00\x00\x00\x00\f\x00\f\x00\x00\x05, \x8E\x810\x9E\xE3@\x14\xE8i\x10\xC4\xD1\x8A\b\x1C\xCF\x80M$z\xEF\xFF0\x85p\xB8\xB01f\r\e\xCE\x01\xC3\x01\x1E\x10' \x82\n\x01\x00;".b
@v << gif
scalar = @v.tree.children.first.children.first
assert_equal Psych::Nodes::Scalar::LITERAL, scalar.style