Sha256: 2ce06a2db7737fdc9e545e3ac588e9fc2ca10669a10034965e096c942811d12f
Contents?: true
Size: 979 Bytes
Versions: 6
Compression:
Stored size: 979 Bytes
Contents
require "spec_helper" RSpec.describe ::Code::Parser do subject { ::Code::Parser.parse(input) } [ "()=>{}", "() => {}", "(a, b) => { add(a, b) }", "(a, b = 1, c:, d: 2, *e, **f) => { }", "(a?, b! = 1, c?:, d?: 2, *e?, *f!, **g?, **h!) => { }" ].each do |input| context input do let!(:input) { input } it { expect { subject }.to_not raise_error } end end [ "(/* cool */)=>{}", "(/* cool */ a)=>{}", "(/* cool */ a:)=>{}", "(a /* cool */ )=>{}", "(a /* cool */ :)=>{}", "(a /* cool */ => 1)=>{}", "(a = /* cool */ 1)=>{}", "(a = 1 /* cool */)=>{}", "(a, /* cool */ b)=>{}", "(a, b /* cool */)=>{}", "(a, b /* cool */ = 1)=>{}", "(a, b: /* cool */)=>{}", "() /* cool */ => {}", "() => /* cool */ {}", "() => { /* cool */ }" ].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