Sha256: 317205fd935e9019cbba3df6be6daec7523ff079f027bce27ae54c4a6698ace5

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 Bytes

Contents

require 'spec_helper'

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, [:sym, :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 == [:int, 1]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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