diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-07-08 22:29:23 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-07-14 17:13:52 +0900 |
commit | 8b64e8f2ed5833570bd1f46683d2b96c7c98413a (patch) | |
tree | 6bee88d676fe4bf5ead54afbeea2f29aad97954f | |
parent | 025677560a477c5d54f6a199447b4c92f367cd39 (diff) | |
download | ruby-8b64e8f2ed5833570bd1f46683d2b96c7c98413a.tar.gz |
[ruby/set] Get rid of use of `Gem::Version`
When retrying in ruby's test, it seems possible that `Gem` is not
loaded.
```
1) Error:
TC_Set_Builtin#test_to_set:
NameError: uninitialized constant TC_Set_Builtin::Gem
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:844:in `should_omit?'
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:869:in `test_to_set'
2) Error:
TC_Set_Builtin#test_Set:
NameError: uninitialized constant TC_Set_Builtin::Gem
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:844:in `should_omit?'
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:849:in
`test_Set'
```
This is by `Gem::Version` only, just compare as array of integers
instead.
https://github.com/ruby/set/commit/cde0a4bbc7
-rw-r--r-- | test/test_set.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/test_set.rb b/test/test_set.rb index 83e28878a0..164dc460a7 100644 --- a/test/test_set.rb +++ b/test/test_set.rb @@ -841,7 +841,7 @@ end class TC_Set_Builtin < Test::Unit::TestCase private def should_omit? - Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.2.0') || + (RUBY_VERSION.scan(/\d+/).map(&:to_i) <=> [3, 2]) < 0 || !File.exist?(File.expand_path('../prelude.rb', __dir__)) end |