Sha256: 9a220ff11e5de7bc5c22508836e480e882502a016c1d28c58a42b9a710be4b47

Contents?: true

Size: 829 Bytes

Versions: 16

Compression:

Stored size: 829 Bytes

Contents

require 'support/parser_helpers'

describe "The not keyword" do
  it "returns a call sexp" do
    parsed("not self").should == [:call, [:self], '!'.to_sym, [:arglist]]
    parsed("not 42").should == [:call, [:int, 42], '!'.to_sym, [:arglist]]
  end
end

describe "The '!' expression" do
  it "returns a call sexp" do
    parsed("!self").should == [:call, [:self], '!'.to_sym, [:arglist]]
    parsed("!42").should == [:call, [:int, 42], '!'.to_sym, [:arglist]]
  end
end

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

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

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
opal-0.8.1 spec/lib/parser/not_spec.rb
opal-0.8.1.rc1 spec/lib/parser/not_spec.rb
opal-0.8.0 spec/lib/parser/not_spec.rb
opal-0.8.0.rc3 spec/lib/parser/not_spec.rb
opal-0.8.0.rc2 spec/lib/parser/not_spec.rb
opal-0.8.0.rc1 spec/lib/parser/not_spec.rb
opal-0.8.0.beta1 spec/lib/parser/not_spec.rb
opal-0.7.2 spec/lib/parser/not_spec.rb
opal-0.7.1 spec/lib/parser/not_spec.rb
opal-0.7.0 spec/lib/parser/not_spec.rb
opal-0.7.0.rc1 spec/lib/parser/not_spec.rb
opal-0.7.0.beta3 spec/lib/parser/not_spec.rb
opal-0.7.0.beta2 spec/lib/parser/not_spec.rb
opal-cj-0.7.0.beta2 spec/lib/parser/not_spec.rb
opal-cj-0.7.0.beta1 spec/lib/parser/not_spec.rb
opal-0.7.0.beta1 spec/lib/parser/not_spec.rb