Sha256: ceacf90f27c5b21cb87f302c971843b0cf8c6b9e5f0d559cfa69c34678511c28

Contents?: true

Size: 604 Bytes

Versions: 5

Compression:

Stored size: 604 Bytes

Contents

require 'spec_helper'

describe "The break keyword" do
  it "should return s(:break) when given no args" do
    opal_parse("break").should == [:break]
  end

  it "returns s(:break) with a single arg not wrapped in s(:array)" do
    opal_parse("break 1").should == [:break, [:int, 1]]
    opal_parse("break *1").should == [:break, [:splat, [:int, 1]]]
  end

  it "returns s(:break) with an s(:array) for args size > 1" do
    opal_parse("break 1, 2").should == [:break, [:array, [:int, 1], [:int, 2]]]
    opal_parse("break 1, *2").should == [:break, [:array, [:int, 1], [:splat, [:int, 2]]]]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-0.5.5 spec/opal/parser/break_spec.rb
opal-0.5.4 spec/opal/parser/break_spec.rb
opal-0.5.2 spec/opal/parser/break_spec.rb
opal-0.5.0 spec/opal/parser/break_spec.rb
opal-0.4.4 spec/parser/break_spec.rb