New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add official testing for Ruby 3.0 #101
Conversation
Codecov Report
@@ Coverage Diff @@
## main #101 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 621 621
=========================================
Hits 621 621
Continue to review full report at Codecov.
|
f8ab2a9
to
684c795
Compare
@@ -78,20 +78,23 @@ For more usage details, see our detailed [documentation](#documentation). | |||
|
|||
## Benchmarks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend viewing either the rich diff or the end result rendered as markdown.
@@ -115,7 +121,7 @@ def positional_splat_keyword_and_double_splat_args(a, *args, b:, **kwargs) | |||
# retrieval time. | |||
instance.no_args | |||
|
|||
x.report("#{benchmark_gem.benchmark_name}: no_args") { instance.no_args } | |||
x.report("#{benchmark_gem.benchmark_name}: ()") { instance.no_args } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the names of benchmarks to make it clearer where they go in the README.
) do | ||
ARGUMENTS.each { |a, b| instance.positional_and_splat_args(a: a, b: b) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was a bug! (It's calling the wrong method 😓)
) do | ||
ARGUMENTS.each do |a, b| | ||
instance.positional_and_splat_args(a, b, a: a, b: b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another bug! (It's calling the wrong method 😓)
@@ -216,15 +224,15 @@ def positional_splat_keyword_and_double_splat_args(a, *args, b:, **kwargs) | |||
# Run once with each set of arguments to memoize the result values, so our | |||
# benchmark only tests memoized retrieval time. | |||
ARGUMENTS.each do |a, b| | |||
instance.positional_splat_keyword_and_double_splat_args(a, b, a: a, b: b) | |||
instance.positional_splat_keyword_and_double_splat_args(a, b, b: b, a: a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched the order of these args because b: b
is the keyword arg and a: a
is **kwargs
and I'm worried that a: a, b: b
might put them both in through **kwargs
and bypass the keyword arg.
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- Logo | |||
- Memoization of class methods | |||
- Support for instances created with `Class#allocate` | |||
- Official testing and benchmarks for Ruby 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth noting that the code itself was also upgraded to have a ruby version of 3.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the .ruby-version
file? I'm not sure that's useful, since that's only used for local development and not users of the gem or our automated tests. Or am I misunderstanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you're totally right, good point, it's internal to the gem.
benchmarks/benchmarks.rb
Outdated
|
||
# Some gems do not yet work in Ruby 3 so we only require them if they're loaded | ||
# in the Gemfile. | ||
%w[memery memoist].each { |gem| require gem if Gem.loaded_specs.key?(gem) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong preference here either, but just looking again, could we include memoized
and memoizer
in the first line to make the second line also a one liner?
%w[memery memoist memoized memoizer].each { |gem| require gem if Gem.loaded_specs.key?(gem) }
# The VERSION constant does not get loaded above.
%w[memoized memoizer].each { |gem| require "#{gem}/version" if Gem.loaded_specs.key?(gem) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice suggestion! Unfortunately those lines are too long. The best we could do would be:
# Some gems do not yet work in Ruby 3 so we only require them if they're loaded
# in the Gemfile.
%w[memery memoist memoized memoizer].
each { |gem| require gem if Gem.loaded_specs.key?(gem) }
# The VERSION constant does not get loaded above.
%w[memoized memoizer].
each { |gem| require "#{gem}/version" if Gem.loaded_specs.key?(gem) }
Up to you; I'm happy with whichever you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I like this better than what we have, if you don't mind changing it! Reads cleaner to me
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- Logo | |||
- Memoization of class methods | |||
- Support for instances created with `Class#allocate` | |||
- Official testing and benchmarks for Ruby 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you're totally right, good point, it's internal to the gem.
benchmarks/benchmarks.rb
Outdated
|
||
# Some gems do not yet work in Ruby 3 so we only require them if they're loaded | ||
# in the Gemfile. | ||
%w[memery memoist].each { |gem| require gem if Gem.loaded_specs.key?(gem) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I like this better than what we have, if you don't mind changing it! Reads cleaner to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Before merging:
README.md
and update this PRCHANGELOG.md
, add an entry following Keep a Changelog guidelines with semantic versioning