Sha256: 1a6c8a72b58abef69f61f37903fd4e847a52757e9b8366e064d7856a398a8ced

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

require 'spec_helper'

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, [:int, 1], [:int, 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, [:int, 1], [:block, [:int, 2], [:int, 3]], true]
  end

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

Version data entries

5 entries across 5 versions & 1 rubygems

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