Sha256: 3c46475cf0d1c2e814cdc4a85a1707ee293ece1e1e57680b7dc661b0ace1dd56

Contents?: true

Size: 759 Bytes

Versions: 5

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'

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, [:int, 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, [:int, 42]]
  end
end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

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