3
3
require "yarp_test_helper"
4
4
5
5
class ParseTest < Test ::Unit ::TestCase
6
+ # Because we're reading the snapshots from disk, we need to make sure that
7
+ # they're encoded as UTF-8. When certain settings are present this might not
8
+ # always be the case (e.g., LANG=C or -Eascii-8bit). So here we force the
9
+ # default external encoding for the duration of the test.
10
+ def setup
11
+ @previous_default_external = Encoding . default_external
12
+ Encoding . default_external = Encoding ::UTF_8
13
+ end
14
+
15
+ def teardown
16
+ Encoding . default_external = @previous_default_external
17
+ end
18
+
6
19
def test_Ruby_3_2_plus
7
20
assert_operator RUBY_VERSION , :>= , "3.2.0" , "ParseTest requires Ruby 3.2+"
8
21
end
@@ -48,24 +61,6 @@ def test_parse_takes_file_path
48
61
assert_equal filepath , find_source_file_node ( parsed_result . value ) . filepath
49
62
end
50
63
51
- # We have some files that are failing on other systems because of default
52
- # encoding. We'll fix these ASAP.
53
- FAILING = %w[
54
- seattlerb/bug202.txt
55
- seattlerb/dsym_esc_to_sym.txt
56
- seattlerb/heredoc_bad_oct_escape.txt
57
- seattlerb/magic_encoding_comment.txt
58
- seattlerb/read_escape_unicode_curlies.txt
59
- seattlerb/read_escape_unicode_h4.txt
60
- seattlerb/regexp_escape_extended.txt
61
- seattlerb/regexp_unicode_curlies.txt
62
- seattlerb/str_evstr_escape.txt
63
- seattlerb/str_lit_concat_bad_encodings.txt
64
- symbols.txt
65
- whitequark/bug_ascii_8bit_in_literal.txt
66
- whitequark/dedenting_heredoc.txt
67
- ]
68
-
69
64
Dir [ File . expand_path ( "fixtures/**/*.txt" , __dir__ ) ] . each do |filepath |
70
65
relative = filepath . delete_prefix ( "#{ File . expand_path ( "fixtures" , __dir__ ) } /" )
71
66
next if known_failures . include? ( relative )
@@ -75,12 +70,6 @@ def test_parse_takes_file_path
75
70
FileUtils . mkdir_p ( directory ) unless File . directory? ( directory )
76
71
77
72
define_method "test_filepath_#{ filepath } " do
78
- if ( ENV . key? ( "RUBYCI_NICKNAME" ) || ENV [ "RUBY_DEBUG" ] =~ /ci/ ) && FAILING . include? ( relative )
79
- # http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20230621T190004Z.fail.html.gz
80
- # http://ci.rvm.jp/results/trunk-yjit@ruby-sp2-docker/4612202
81
- omit "Not working on RubyCI and ci.rvm.jp"
82
- end
83
-
84
73
# First, read the source from the filepath. Use binmode to avoid converting CRLF on Windows,
85
74
# and explicitly set the external encoding to UTF-8 to override the binmode default.
86
75
source = File . read ( filepath , binmode : true , external_encoding : Encoding ::UTF_8 )
0 commit comments