Sha256: e37117523f8eee57f2ca84fa274703fe6d10a53c703e145d34e2c073c38412a5
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require File.expand_path('../test_helper.rb', File.dirname(__FILE__)) require 'ruby_parser' describe "Using RipperRubyParser and RubyParser" do def to_line_numbers exp exp.map! do |sub_exp| if sub_exp.is_a? Sexp to_line_numbers sub_exp else sub_exp end end if exp.sexp_type == :scope exp else s(:line_number, exp.line, exp) end end let :newparser do RipperRubyParser::Parser.new end let :oldparser do RubyParser.new end describe "for a multi-line program" do let :program do <<-END class Foo def foo() bar() baz(qux) end end module Bar @@baz = {} end END end let :original do oldparser.parse program end let :imitation do newparser.parse program end it "gives the same result" do imitation.must_equal original end it "gives the same result with line numbers" do formatted(to_line_numbers(imitation)). must_equal formatted(to_line_numbers(original)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ripper_ruby_parser-1.1.1 | test/end_to_end/line_numbering_test.rb |
ripper_ruby_parser-1.1.0 | test/end_to_end/line_numbering_test.rb |