Sha256: 31568ebdfffc99b85762b84a2a0101ffab73aa0abffb59a835218d9b4580fa8f

Contents?: true

Size: 593 Bytes

Versions: 6

Compression:

Stored size: 593 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe "The while keyword" do
  it "returns an s(:while) with the given expr, body and true for head" do
    opal_parse("while 1; 2; end").should == [:while, [:lit, 1], [:lit, 2], true]
  end

  it "uses an s(:block) if body has more than one statement" do
    opal_parse("while 1; 2; 3; end").should == [:while, [:lit, 1], [:block, [:lit, 2], [:lit, 3]], true]
  end

  it "treats the prefix while statement just like a regular while statement" do
    opal_parse("1 while 2").should == [:while, [:lit, 2], [:lit, 1], true]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.20 spec/grammar/while_spec.rb
opal-0.3.19 spec/grammar/while_spec.rb
opal-0.3.18 spec/grammar/while_spec.rb
opal-0.3.17 test/grammar/while_spec.rb
opal-0.3.16 spec/grammar/while_spec.rb
opal-0.3.15 spec/grammar/while_spec.rb