diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1adb570..c67a409 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: name: build (${{ matrix.ruby }} / ${{ matrix.os }}) strategy: matrix: - ruby: [ 3.0, head ] + ruby: [ 3.0, 2.7, 2.6, head ] os: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.os }} steps: diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 1d4ed28..22c9858 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -341,6 +341,12 @@ path_realdirpath(int argc, VALUE *argv, VALUE self) return rb_class_new_instance(1, &str, rb_obj_class(self)); } +#ifndef RB_PASS_KEYWORDS +/* Only define macros on Ruby <2.7 */ +#define rb_funcallv_kw(o, m, c, v, kw) rb_funcallv(o, m, c, v) +#define rb_block_call_kw(o, m, c, v, f, p, kw) rb_block_call(o, m, c, v, f, p) +#endif + /* * call-seq: * pathname.each_line {|line| ... } diff --git a/pathname.gemspec b/pathname.gemspec index 8593f9e..c81dc19 100644 --- a/pathname.gemspec +++ b/pathname.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |spec| spec.summary = %q{Representation of the name of a file or directory on the filesystem} spec.description = %q{Representation of the name of a file or directory on the filesystem} spec.homepage = "https://github.com/ruby/pathname" - spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") + spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0") spec.licenses = ["Ruby", "BSD-2-Clause"] spec.metadata["homepage_uri"] = spec.homepage diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 8a0f3cb..30af579 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -1068,6 +1068,7 @@ def test_expand_path def test_split assert_equal([Pathname("dirname"), Pathname("basename")], Pathname("dirname/basename").split) + omit unless RUBY_VERSION >= '2.7.0' assert_separately([], <<-'end;') require 'pathname' @@ -1481,6 +1482,7 @@ def test_file_fnmatch end def test_relative_path_from_casefold + omit unless RUBY_VERSION >= '2.7.0' assert_separately([], <<-'end;') # do module File::Constants remove_const :FNM_SYSCASE diff --git a/test/pathname/test_ractor.rb b/test/pathname/test_ractor.rb index 9ce43ef..3d7b63d 100644 --- a/test/pathname/test_ractor.rb +++ b/test/pathname/test_ractor.rb @@ -4,7 +4,7 @@ class TestPathnameRactor < Test::Unit::TestCase def setup - skip unless defined? Ractor + omit unless defined? Ractor end def test_ractor_shareable