Sha256: 26ec75a45a16700f44665487eb5e5890cd01f041a04895abadf631f5007ee144

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')
require 'benchmark'

class CircularCompilationTest < CompilerTestCase
  test "the generated metagrammar parser can parse the treetop file whence it came" do
    File.open(METAGRAMMAR_PATH, 'r') do |file|
      input = file.read
      result = Treetop::Compiler::MetagrammarParser.new.parse(input)
      result.should be_success
            
      Treetop::Compiler.send(:remove_const, :Metagrammar)
      parser_code = result.compile
      
      Object.class_eval(parser_code)
      
      r = Treetop::Compiler::MetagrammarParser.new.parse(input)
      r.should be_success
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
treetop-1.0.1 test/compiler/circular_compilation_test.rb
treetop-1.1.0 test/compiler/circular_compilation_test.rb
treetop-1.1.2 test/compiler/circular_compilation_test.rb
treetop-1.0.0 test/compiler/circular_compilation_test.rb
treetop-1.0.2 test/compiler/circular_compilation_test.rb
treetop-1.1.1 test/compiler/circular_compilation_test.rb