Sha256: 7745bc362f933cf9a63a1de20f1eb4652b97246f2c5a3ff7bb4ce99f39406f7e

Contents?: true

Size: 806 Bytes

Versions: 12

Compression:

Stored size: 806 Bytes

Contents

require "spec_helper"

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

  [
    "{}",
    "{a:1}",
    "{ a: 1 }",
    "{ :a => 1 }",
    "{ :a => 1, b: 2 }",
    "{ :a => 1, b: { c: 2 } }"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { subject }
    end
  end

  [
    "{ /* cool */ }",
    "{ a /* cool */ : 1",
    "{ a /* cool */ => 1",
    "{ a: 1 /* cool */ }",
    "{ a: 1, /* cool */ b: 2 }",
    "{ a: 1, b /* cool */ : 2 }",
    "{ a: 1, b /* cool */ => 2 }",
    "{ a: 1, b => /* cool */ 2 }",
    "{ a: 1, b => 2 /* cool */ }",
    "{ /* cool */ **kargs }",
    "{ **kargs /* cool */ }"
  ].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/dictionnary_spec.rb
code-ruby-parser-0.1.8 spec/code/parser/dictionnary_spec.rb
template-ruby-parser-0.1.7 spec/code/parser/dictionnary_spec.rb
code-ruby-parser-0.1.7 spec/code/parser/dictionnary_spec.rb
template-ruby-parser-0.1.6 spec/code/parser/dictionnary_spec.rb
code-ruby-parser-0.1.6 spec/code/parser/dictionnary_spec.rb
template-ruby-parser-0.1.5 spec/code/parser/dictionnary_spec.rb
code-ruby-parser-0.1.5 spec/code/parser/dictionnary_spec.rb
template-ruby-parser-0.1.4 spec/code/parser/dictionnary_spec.rb
code-ruby-parser-0.1.4 spec/code/parser/dictionnary_spec.rb
template-ruby-parser-0.1.3 spec/code/parser/dictionnary_spec.rb
code-ruby-parser-0.1.3 spec/code/parser/dictionnary_spec.rb