Sha256: e2d75bf1acbfaf630cebc2dc5c02931bfd00328dca4708e30e040c2e694564a4

Contents?: true

Size: 759 Bytes

Versions: 26

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, [: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

26 entries across 26 versions & 1 rubygems

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