-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Compiler parser spec cleanup #15446
base: master
Are you sure you want to change the base?
Compiler parser spec cleanup #15446
Conversation
I too prefer unrolled loops for explicitness and grepability. The loops however do provide value in grouping: They express that all examples are functionally equivalent, just testing different values. Some sense of togetherness could be established by grouping the examples via The other aspect of functional equivalence has particular relevance for more complex examples: Generalizing the implementation helps keep the code clean and easy to read. For example, extract the shared plumbing into a spec helper method and let the unrolled loop items call that explicitly. Perhaps that could be a strategy to explore for further enhancements of the more complex loops not touched in thie PR. # loop
%[a b c].each do |value|
it "#{value} foo" do
assert_fooing(value)
end
end
# unrolled with helper
private def it_foos(value)
it "#{value}.foo" do
assert_fooing(value)
end
end
it_foos "a"
it_foos "b"
it_foos "c" For this PR I'd like to have the former loops grouped into describe blocks. |
Note: Commit ea79701 may be controversial. I slightly prefer explicit test cases over loops, but I have no strong feelings either way!