Bug #18022
closedSpec errors for rbconfig/unicode_[emoji_]version_spec: Using Ruby 2.7 even when on Ruby 3.1
Updated by Eregon (Benoit Daloze) over 3 years ago
What's the issue and what's the error like?
I guess you mean https://github.com/ruby/ruby/blob/2488589b2f1a70dbfdc4155ac9bea3c533ef35d8/spec/ruby/library/rbconfig/unicode_version_spec.rb#L23-L27?
That until now is the Unicode version from 2.6.3 until the current revision.
ruby_version_is "2.6.3" do
means 2.6.3+, so yes it includes 3.1.0.
If we have a new Unicode version, simply update the spec and add a new it
.
Updated by duerst (Martin Dürst) over 3 years ago
[sorry, hitting Enter too early]
Working on upgrading Ruby 3.1 to Unicode version 13.0.0 and Unicode Emoji version 13.0, I'm getting the following errors:
194)
RbConfig::CONFIG['UNICODE_EMOJI_VERSION'] is 12.1 for Ruby 2.7 FAILED
Expected "13.0" == "12.1"
to be truthy but was false
/home/duerst/ruby3/spec/ruby/library/rbconfig/unicode_emoji_version_spec.rb:19:in `block (3 levels) in <top (required)>'
/home/duerst/ruby3/spec/ruby/library/rbconfig/unicode_emoji_version_spec.rb:4:in `<top (required)>'
195)
RbConfig::CONFIG['UNICODE_VERSION'] is 12.1.0 for Ruby 2.6.3+ and Ruby 2.7 FAILED
Expected "13.0.0" == "12.1.0"
to be truthy but was false
/home/duerst/ruby3/spec/ruby/library/rbconfig/unicode_version_spec.rb:25:in `block (3 levels) in <top (required)>'
/home/duerst/ruby3/spec/ruby/library/rbconfig/unicode_version_spec.rb:4:in `<top (required)>'
This looks weird to me because I'm on Ruby version 3.1.0dev. while the specs mention only versions such as 2.6 or 2.7. How can I fix this? In particular, it's unclear for me what I should do to express that the Unicode/Emoji version changes in the middle of a Ruby dev version.
Updated by duerst (Martin Dürst) over 3 years ago
- Blocks Feature #17750: Update Unicode data to Unicode Version 13.0.0 added
Updated by duerst (Martin Dürst) over 3 years ago
- Status changed from Open to Feedback
Okay, I changed the last it
by extending its version to 3.0
, and added a new it
, as follows (and similar for emoji):
ruby_version_is "2.6.3"..."3.0" do
it "is 12.1.0 for Ruby 2.6.3+, Ruby 2.7, and Ruby 3.0" do
RbConfig::CONFIG['UNICODE_VERSION'].should == "12.1.0"
end
end
ruby_version_is "3.1" do
it "is 13.0.0 for Ruby 3.1" do
RbConfig::CONFIG['UNICODE_VERSION'].should == "13.0.0"
end
end
That got rid of the errors, but I'm of course not sure that this does the right thing for older versions.
(When running make test-spec
, I also get a lot of errors that say NoMethodError: undefined method
started?' for nil:NilClass, always for
@http.finish if @http.started?`, but I'm assuming these are unrelated to what I'm doing.)
Updated by Eregon (Benoit Daloze) over 3 years ago
I see, you simply need to adapt the guards, like:
ruby_version_is "2.6.3"..."3.1" do
it "is 12.1.0 for Ruby 2.6.3+ to Ruby 3.1" do
RbConfig::CONFIG['UNICODE_VERSION'].should == "12.1.0"
end
end
ruby_version_is "3.1" do
it "is 13.0.0 for Ruby 3.1+" do
RbConfig::CONFIG['UNICODE_VERSION'].should == "13.0.0"
end
end
Older dev versions are basically considered non-existing in specs/tests, so we can just ignore that.
Updated by Eregon (Benoit Daloze) over 3 years ago
What you wrote above is almost correct, but it should be ruby_version_is "2.6.3"..."3.1" do
.
It's an exclusive range, and so until 3.1, excluded.
From a ruby_version_is
point of view, the dev
part of 3.1.0dev
is irrelevant, because it only checks RUBY_VERSION, and that's "3.1.0"
.
Updated by Eregon (Benoit Daloze) over 3 years ago
(When running make test-spec, I also get a lot of errors that say NoMethodError: undefined methodstarted?' for nil:NilClass, always for@http.finish if @http.started?`, but I'm assuming these are unrelated to what I'm doing.)
That's probably related to webrick, you might need to gem install webrick
on that dev Ruby.
However, I just tried and it works fine for me with make test-spec MSPECOPT="-j"
.
Updated by duerst (Martin Dürst) over 3 years ago
- Status changed from Feedback to Closed
Many thanks for your advice, @Eregon (Benoit Daloze). The webrick-related spec failures are continuing, but I'm closing this issue.