Sha256: c957a070373797e6ebcbcffc46010331d725a64c1b27ec5ad051a653a36fd6dc

Contents?: true

Size: 559 Bytes

Versions: 26

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, [: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

26 entries across 26 versions & 1 rubygems

Version Path
opal-0.4.3 spec/parser/while_spec.rb
opal-0.4.2 spec/parser/while_spec.rb
opal-0.4.1 spec/parser/while_spec.rb
opal-0.4.0 spec/parser/while_spec.rb
opal-0.3.44 spec/parser/while_spec.rb
opal-0.3.43 spec/parser/while_spec.rb
opal-0.3.42 spec/grammar/while_spec.rb
opal-0.3.41 spec/grammar/while_spec.rb
opal-0.3.40 spec/grammar/while_spec.rb
opal-0.3.39 spec/grammar/while_spec.rb
opal-0.3.38 spec/grammar/while_spec.rb
opal-0.3.37 spec/grammar/while_spec.rb
opal-0.3.36 spec/grammar/while_spec.rb
opal-0.3.35 spec/grammar/while_spec.rb
opal-0.3.34 spec/grammar/while_spec.rb
opal-0.3.33 spec/grammar/while_spec.rb
opal-0.3.32 spec/grammar/while_spec.rb
opal-0.3.31 spec/grammar/while_spec.rb
opal-0.3.30 spec/grammar/while_spec.rb
opal-0.3.29 spec/grammar/while_spec.rb