Sha256: 1814b65b1de78729e60873ea2267f7941cff5ff9ac14f05794bd2d1d71e86fb9

Contents?: true

Size: 793 Bytes

Versions: 6

Compression:

Stored size: 793 Bytes

Contents

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

describe "The not keyword" do
  it "returns s(:not) with the single argument" do
    opal_parse("not self").should == [:not, [:self]]
    opal_parse("not 42").should == [:not, [:lit, 42]]
  end
end

describe "The '!' expression" do
  it "returns s(:not) with the single argument" do
    opal_parse("!self").should == [:not, [:self]]
    opal_parse("!42").should == [:not, [:lit, 42]]
  end
end

describe "The '!=' expression" do
  it "rewrites as !(lhs == rhs)" do
    opal_parse("1 != 2").should == [:not, [:call, [:lit, 1], :==, [:arglist, [:lit, 2]]]]
  end
end

describe "The '!~' expression" do
  it "rewrites as !(lhs =~ rhs)" do
    opal_parse("1 !~ 2").should == [:not, [:call, [:lit, 1], :=~, [:arglist, [:lit, 2]]]]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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