Sha256: e3bc9335cab11bb3cca33bed86bb442745d7f5baba25efc92fdfca07a3569873

Contents?: true

Size: 714 Bytes

Versions: 6

Compression:

Stored size: 714 Bytes

Contents

require "spec_helper"

RSpec.describe ::Code::Parser do
  subject { ::Code::Parser.parse(input) }

  [
    "a = 1",
    "a += 1",
    "a -= 1",
    "a *= 1",
    "a /= 1",
    "a <<= 1",
    "a >>= 1",
    "a &= 1",
    "a |= 1",
    "a ^= 1",
    "a %= 1",
    "a ||= 1",
    "a &&= 1",
    "a = b = 1",
    "a = b += c"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { expect { subject }.to_not raise_error }
    end
  end

  [
    "a /* cool */ = 1",
    "a += /* cool */ 1",
    "a = b -= /* cool */ 1",
    "a = b /* cool */ *= 1"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { expect(subject.to_json).to include("cool") }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
template-ruby-parser-0.1.2 spec/code/parser/equal_spec.rb
code-ruby-parser-0.1.2 spec/code/parser/equal_spec.rb
template-ruby-parser-0.1.1 spec/code/parser/equal_spec.rb
code-ruby-parser-0.1.1 spec/code/parser/equal_spec.rb
template-ruby-parser-0.1.0 spec/code/parser/equal_spec.rb
code-ruby-parser-0.1.0 spec/code/parser/equal_spec.rb