Sha256: 347cff319055979b0c2d9b729024490473e9165b80a2eca14e77067777ac1d64
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' describe Melbourne::Parser do it 'should correctly parse "/x/ =~ "blah""' do ruby = '/x/ =~ "blah"' ast = {:match2=> {:@line=>1, :@value=>{:stringliteral=>{:@string=>:blah, :@line=>1}}, :@pattern=>{:regexliteral=>{:@source=>:x, :@options=>0, :@line=>1}}}} ruby.should parse_as(ast) end it 'should correctly parse "x = "x"; /#{x}/ =~ x"' do ruby = <<-ruby x = "x" /\#{x}/ =~ x ruby ast = {:block=> {:@array=> [{:localvariableassignment=> {:@variable=>nil, :@name=>:x, :@line=>1, :@value=>{:stringliteral=>{:@string=>:x, :@line=>1}}}}, {:match2=> {:@line=>2, :@value=> {:localvariableaccess=>{:@variable=>nil, :@name=>:x, :@line=>2}}, :@pattern=> {:dynamicregex=> {:@string=>:"<blank>", :@array=> [{:tostring=> {:@line=>2, :@value=> {:localvariableaccess=> {:@variable=>nil, :@name=>:x, :@line=>2}}}}], :@options=>0, :@line=>2}}}}], :@line=>1}} ruby.should parse_as(ast) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
melbourne-1.0.1 | spec/lib/parser/match2_spec.rb |
melbourne-1.0.0 | spec/lib/parser/match2_spec.rb |