Sha256: 0b7712cc4f09923c8cf5459a1e1b7cdfdf31a5660f0ed461f2425fd3d7e3a20e

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

require "spec_helper"

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

  [
    "if b",
    "if a b",
    "if a end",
    "if b a end",
    "if a b else c",
    "if a b elsif c d else e",
    "if a b else if c d",
    "if a b else unless c d"
  ].each do |input|
    context input do
      let!(:input) { input }

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

  [
    "if /* cool */ a",
    "if a /* cool */ b",
    "if a b /* cool */ else c",
    "if a b else /* cool */ c",
    "if a b elsif /* cool */ c d else e",
    "if a b else /* cool */ if c d",
    "if a b else if /* cool */ c d",
    "if a b else unless /* cool */ c d"
  ].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/if_spec.rb
code-ruby-parser-0.1.2 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.1 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.1 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.0 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.0 spec/code/parser/if_spec.rb