diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-23 19:16:16 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-06-24 15:32:11 +0900 |
| commit | 97152d44dcd7072a22574cc15c82e4bfa901cd16 (patch) | |
| tree | 5defa5dc7a8c1a99e31b6f6607aeafc37c7828b5 /test | |
| parent | 261e3663fdabd1665d0b978ecd12b0ddb639b190 (diff) | |
[ruby/yarp] Name test methods from relative paths
Full path name of the source directory is a useless noise as tests.
https://github.com/ruby/yarp/commit/44a7ae2e64
Diffstat (limited to 'test')
| -rw-r--r-- | test/yarp/parse_test.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/yarp/parse_test.rb b/test/yarp/parse_test.rb index 75d3849614..08b8ca948e 100644 --- a/test/yarp/parse_test.rb +++ b/test/yarp/parse_test.rb @@ -61,15 +61,16 @@ class ParseTest < Test::Unit::TestCase assert_equal filepath, find_source_file_node(parsed_result.value).filepath end - Dir[File.expand_path("fixtures/**/*.txt", __dir__)].each do |filepath| - relative = filepath.delete_prefix("#{File.expand_path("fixtures", __dir__)}/") + base = File.join(__dir__, "fixtures") + Dir["**/*.txt", base: base].each do |relative| next if known_failures.include?(relative) + filepath = File.join(base, relative) snapshot = File.expand_path(File.join("snapshots", relative), __dir__) directory = File.dirname(snapshot) FileUtils.mkdir_p(directory) unless File.directory?(directory) - define_method "test_filepath_#{filepath}" do + define_method "test_filepath_#{relative}" do # First, read the source from the filepath. Use binmode to avoid converting CRLF on Windows, # and explicitly set the external encoding to UTF-8 to override the binmode default. source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8) |
