Skip to content
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 specs for argument coercion (#to_int, #to_str) in Signal #1074

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

herwinw
Copy link
Member

@herwinw herwinw commented Sep 10, 2023

No description provided.

core/signal/signame_spec.rb Show resolved Hide resolved
core/signal/trap_spec.rb Outdated Show resolved Hide resolved
hup = Signal.list["HUP"]
Signal.trap hup, @proc
Signal.trap(hup, @saved_trap).should equal(@proc)
end
Copy link
Member

@andrykonchin andrykonchin Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I would check also that Signal.list["HUP"] returns Integer but not some other type:

hup = Signal.list["HUP"]
hup.should.is_a?(Integer)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file list_spec.rb contains these two tests:

it "includes the EXIT key with a value of zero" do
  Signal.list["EXIT"].should == 0
end

it "includes the KILL key with a value of nine" do
  Signal.list["KILL"].should == 9
end

I would guess the return type is covered here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may help to maintain this test case in future (and make it more readable) as for me. As a reader I may not remember what Signal.list returns at all and explicit check just makes the value type explicit. But it's a subjective topic of course.

@herwinw herwinw marked this pull request as draft September 25, 2023 10:55
@herwinw herwinw marked this pull request as ready for review September 26, 2023 17:01
@andrykonchin
Copy link
Member

Could you please squash commits and I will merge the PR then?

@herwinw herwinw force-pushed the signal_argument_coercion branch from 968d483 to e8c660f Compare September 27, 2023 05:38
@herwinw
Copy link
Member Author

herwinw commented Sep 27, 2023

Could you please squash commits and I will merge the PR then?

They're squashed into 1 commit. Only 9 more review to go, I'll try to have a look at them somewhere this week.

@andrykonchin
Copy link
Member

Thank you!

@andrykonchin andrykonchin merged commit ee20cf3 into ruby:master Sep 27, 2023
10 checks passed
@herwinw herwinw deleted the signal_argument_coercion branch September 27, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants