Sha256: 9195e64f33db803b9a3aadb766322f23e86c53eeefec84323f18c294dc75a4c9

Contents?: true

Size: 634 Bytes

Versions: 6

Compression:

Stored size: 634 Bytes

Contents

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

describe "op_asgn1" do
  it "returns s(:op_asgn1)" do
    opal_parse('self[:foo] += 1')[0].should == :op_asgn1
  end

  it "correctly assigns the receiver" do
    opal_parse("self[:foo] += 1")[1].should == [:self]
  end

  it "returns an arglist for args inside braces" do
    opal_parse("self[:foo] += 1")[2].should == [:arglist, [:lit, :foo]]
  end

  it "only uses the operator, not with '=' appended" do
    opal_parse("self[:foo] += 1")[3].should == :+
  end

  it "uses a simple sexp, not an arglist" do
    opal_parse("self[:foo] += 1")[4].should == [:lit, 1]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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