Sha256: a602817a9f2cc1b14153648dc6fcf0b32991b30dfd3988a302439388234b10eb

Contents?: true

Size: 563 Bytes

Versions: 6

Compression:

Stored size: 563 Bytes

Contents

require "spec_helper"

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

  ["a ? b : c", "a ? b", "a ? b ? c : d : e", "a ? b ? c : d"].each do |input|
    context input do
      let!(:input) { input }

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

  [
    "a /* cool */ ? b : c",
    "a ? /* cool */ b",
    "a ? b /* cool */ ? c : d : e",
    "a ? b ? /* 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/ternary_spec.rb
code-ruby-parser-0.1.2 spec/code/parser/ternary_spec.rb
template-ruby-parser-0.1.1 spec/code/parser/ternary_spec.rb
code-ruby-parser-0.1.1 spec/code/parser/ternary_spec.rb
template-ruby-parser-0.1.0 spec/code/parser/ternary_spec.rb
code-ruby-parser-0.1.0 spec/code/parser/ternary_spec.rb