Sha256: 031561d006847cd062cc565af3f9fb52543d0e85629b48912a345647e40fbfbb

Contents?: true

Size: 1.55 KB

Versions: 19

Compression:

Stored size: 1.55 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

module Racc
  class TestChkY < TestCase
    def setup
      super
      file = File.join(ASSET_DIR, 'chk.y')
      @debug_flags = Racc::DebugFlags.parse_option_string('o')
      parser = Racc::GrammarFileParser.new(@debug_flags)
      @result = parser.parse(File.read(file), File.basename(file))
      @states = Racc::States.new(@result.grammar).nfa
      @states.dfa
    end

    def test_compile_chk_y
      generator = Racc::ParserFileGenerator.new(@states, @result.params.dup)

      # it generates valid ruby
      assert Module.new {
        self.instance_eval(generator.generate_parser, __FILE__, __LINE__)
      }

      grammar = @states.grammar

      assert_equal 0, @states.n_srconflicts
      assert_equal 0, @states.n_rrconflicts
      assert_equal 0, grammar.n_useless_nonterminals
      assert_equal 0, grammar.n_useless_rules
      assert_nil grammar.n_expected_srconflicts
    end

    def test_compile_chk_y_line_convert
      params = @result.params.dup
      params.convert_line_all = true

      generator = Racc::ParserFileGenerator.new(@states, @result.params.dup)

      # it generates valid ruby
      assert Module.new {
        self.instance_eval(generator.generate_parser, __FILE__, __LINE__)
      }

      grammar = @states.grammar

      assert_equal 0, @states.n_srconflicts
      assert_equal 0, @states.n_rrconflicts
      assert_equal 0, grammar.n_useless_nonterminals
      assert_equal 0, grammar.n_useless_rules
      assert_nil grammar.n_expected_srconflicts
    end
  end
end

Version data entries

19 entries across 14 versions & 4 rubygems

Version Path
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/test_chk_y.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/test_chk_y.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/test_chk_y.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/test_chk_y.rb
racc-1.5.2-java test/test_chk_y.rb
racc-1.5.2 test/test_chk_y.rb
racc-1.5.1-java test/test_chk_y.rb
racc-1.5.1 test/test_chk_y.rb
racc-1.5.0-java test/test_chk_y.rb
racc-1.5.0 test/test_chk_y.rb
racc-1.4.16-java test/test_chk_y.rb
racc-1.4.16 test/test_chk_y.rb