Sync ruby/yarp with sync_default_gems

This commit is contained in:
Takashi Kokubun 2023-06-22 08:59:04 -07:00
parent 1344de5621
commit edd488109f
2 changed files with 2 additions and 15 deletions

View File

@ -3,19 +3,6 @@
require "yarp_test_helper" require "yarp_test_helper"
class ParseTest < Test::Unit::TestCase class ParseTest < Test::Unit::TestCase
# Because we're reading the snapshots from disk, we need to make sure that
# they're encoded as UTF-8. When certain settings are present this might not
# always be the case (e.g., LANG=C or -Eascii-8bit). So here we force the
# default external encoding for the duration of the test.
def setup
@previous_default_external = Encoding.default_external
Encoding.default_external = Encoding::UTF_8
end
def teardown
Encoding.default_external = @previous_default_external
end
def test_Ruby_3_2_plus def test_Ruby_3_2_plus
assert_operator RUBY_VERSION, :>=, "3.2.0", "ParseTest requires Ruby 3.2+" assert_operator RUBY_VERSION, :>=, "3.2.0", "ParseTest requires Ruby 3.2+"
end end
@ -34,6 +21,7 @@ class ParseTest < Test::Unit::TestCase
# and the line breaks based on the length of the path. # and the line breaks based on the length of the path.
def normalize_printed(printed) def normalize_printed(printed)
printed printed
.b
.gsub( .gsub(
/SourceFileNode \s* /SourceFileNode \s*
\(\s* (\d+\.\.\.\d+) \s*\) \s* \(\s* (\d+\.\.\.\d+) \s*\) \s*
@ -87,7 +75,7 @@ class ParseTest < Test::Unit::TestCase
assert_empty result.errors, value assert_empty result.errors, value
if File.exist?(snapshot) if File.exist?(snapshot)
normalized = normalize_printed(File.read(snapshot)) normalized = normalize_printed(File.binread(snapshot))
# If the snapshot file exists, but the printed value does not match the # If the snapshot file exists, but the printed value does not match the
# snapshot, then update the snapshot file. # snapshot, then update the snapshot file.

View File

@ -72,7 +72,6 @@ source_file_load(source_t *source, VALUE filepath) {
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
if (!source->size) { if (!source->size) {
close(fd);
source->source = ""; source->source = "";
return 0; return 0;
} }