Sha256: 0c70bc89e9cc632b3ece2c88ffb0213acfc78a0b44d1556cd0727ab8968a07e5

Contents?: true

Size: 578 Bytes

Versions: 26

Compression:

Stored size: 578 Bytes

Contents

require 'spec_helper'

describe "The unless keyword" do
  it "returns s(:if) with reversed true and false bodies" do
    opal_parse("unless 10; 20; end").should == [:if, [:lit, 10], nil, [:lit, 20]]
    opal_parse("unless 10; 20; 30; end").should == [:if, [:lit, 10], nil, [:block, [:lit, 20], [:lit, 30]]]
    opal_parse("unless 10; 20; else; 30; end").should == [:if, [:lit, 10], [:lit, 30], [:lit, 20]]
  end

  it "returns s(:if) with reversed true and false bodies for prefix unless" do
    opal_parse("20 unless 10").should == [:if, [:lit, 10], nil, [:lit, 20]]
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

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