Sha256: 89328cc38434bd3889783255c9139683c425a1c84ba8a56fd58b1aa66b8f09aa

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 Bytes

Contents

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-0.6.3 spec/cli/parser/unless_spec.rb
opal-0.6.2 spec/cli/parser/unless_spec.rb
opal-0.6.1 spec/cli/parser/unless_spec.rb
opal-0.6.0 spec/cli/parser/unless_spec.rb