Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0ae299d799eb
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4b2880482ebb
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Mar 17, 2015

  1. Add specs for #3360 (case-when with splatted arrays from variables).

    This adds some test cases for #3360. Rubinius 2.5.2 fails to compile
    case-when statements with splatted arrays coming from variables. Only
    the latter two specs fail, though.
    Malte Rohde committed Mar 17, 2015

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f4a22e9 View commit details

Commits on Mar 18, 2015

  1. Merge pull request #3362 from FlavourSys/specs-for-issue-3360

    Add specs for #3360 (case-when with splatted arrays from variables).
    jemc committed Mar 18, 2015
    Copy the full SHA
    4b28804 View commit details
Showing with 41 additions and 0 deletions.
  1. +41 −0 spec/ruby/language/case_spec.rb
41 changes: 41 additions & 0 deletions spec/ruby/language/case_spec.rb
Original file line number Diff line number Diff line change
@@ -143,6 +143,47 @@ def bar; @calls << :bar; end
end.should == "foo"
end

it "takes an expanded array before additional listed values" do
case 'f'
when *['a', 'b', 'c', 'd'], 'f'
"foo"
when *['x', 'y', 'z']
"bar"
end.should == 'foo'
end

it "expands arrays from variables before additional listed values" do
a = ['a', 'b', 'c']
case 'a'
when *a, 'd', 'e'
"foo"
when 'x'
"bar"
end.should == "foo"
end

it "expands arrays from variables before a single additional listed value" do
a = ['a', 'b', 'c']
case 'a'
when *a, 'd'
"foo"
when 'x'
"bar"
end.should == "foo"
end

it "expands multiple arrays from variables before additional listed values" do
a = ['a', 'b', 'c']
b = ['d', 'e', 'f']

case 'f'
when *a, *b, 'g', 'h'
"foo"
when 'x'
"bar"
end.should == "foo"
end

# MR: critical
it "concats arrays before expanding them" do
a = ['a', 'b', 'c', 'd']