Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Spec: Parse `a.b {|(*)|}`. #2094

wants to merge 1 commit into from

2 participants


Implementing this should fix #2073.

I'm not sure if the example name is a good one. It's not clear to me
yet why someone would want to put parentheses around the *. It should
just get Ruby to unpack the argument before it throws it away.

Also, what's interesting about getting it to pass isn't so much its
behavior (which should match the un-parenthesesed version) as the fact
that it parses.


If you add specs in a pull request without fixing the issue, you should also add tags for the spec in a separate commit. Also see:


Thanks, @dbussink. I really don't understand how tags work, and that page just explains how to manipulate them using the mspec-tag command. Is there an overview of what they're for and what they mean?


We tag specs that fail at the moment. This gives us a way to track what still needs to be fixed. We also use this to keep our continuous integration green, so we can catch regressions. So if we add specs that fail, we need to either fix the bug or add a tag for it so we explicitly say that it still, but don't want the build to fail because of it.


Got it. So if I tag it as --fail, it'll pass CI, because it's expected to fail, yes?

This commit adds one example to a rather large spec; won't tagging it make the whole spec stop running until it's implemented?


Tags work on the level of it {} blocks, so the other ones will keep running fine. --fail is also the default for mspec tag, so no need to specify it.


Ah. So. Problem.

The error is not at run time, but at compile time. That means that the error throws too early, none of the actual tests run, and (among other things) the tag can't be set.

One solution would be to put the code in an #eval to put the compilation into the context of the example. But is there in fact a better place for parser specs? I couldn't find one, but I may not have looked hard enough.

@dbussink dbussink closed this pull request from a commit
@dbussink dbussink Fix pattern matching specs with post splat arguments
This handles pattern matching for post splat block arguments.

Fixes #1569, fixes #2073, fixes #2094, fixes #1777
@dbussink dbussink closed this in 2ab0d14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 9, 2012
  1. @Peeja

    Spec: Parse `a.b {|(*)|}`.

    Peeja authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 spec/ruby/language/block_spec.rb
6 spec/ruby/language/block_spec.rb
@@ -283,6 +283,12 @@
+ describe "taking |(*)| arguments" do
+ it "does not raise an exception when no values are yielded" do
+ @y.z { |(*)| 1 }.should == 1
+ end
+ end
describe "taking |*a| arguments" do
it "assigns '[]' to the argument when no values are yielded" do
@y.z { |*a| a }.should == []
Something went wrong with that request. Please try again.