Sha256: 401cbce8bb443e099ae84e405e61c92ece4de40b431b358ca91cea85b3f1835a

Contents?: true

Size: 794 Bytes

Versions: 12

Compression:

Stored size: 794 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 { subject }
    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

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-parser-0.1.8 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.8 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.7 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.7 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.6 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.6 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.5 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.5 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.4 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.4 spec/code/parser/if_spec.rb
template-ruby-parser-0.1.3 spec/code/parser/if_spec.rb
code-ruby-parser-0.1.3 spec/code/parser/if_spec.rb