From ce9fc203d1e7cd97d68fab6e10733bd62f065c5a Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 27 Oct 2014 05:53:22 +0000 Subject: [PATCH] test_parser_events.rb: split test_binary * test/ripper/test_parser_events.rb (test_binary): split for each operators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_parser_events.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 1942157b89..ed026785db 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -9,13 +9,10 @@ end class TestRipper::ParserEvents < Test::Unit::TestCase - # should be enabled def test_event_coverage - dispatched = Ripper::PARSER_EVENTS.map {|event,*| event } - dispatched.each do |e| - assert_equal true, respond_to?("test_#{e}", true), - "event not tested: #{e.inspect}" - end + dispatched = Ripper::PARSER_EVENTS + tested = self.class.instance_methods(false).grep(/\Atest_(\w+)/) {$1.intern} + assert_empty dispatched-tested end def parse(str, nm = nil, &bl) @@ -249,9 +246,8 @@ class TestRipper::ParserEvents < Test::Unit::TestCase assert_equal true, thru_begin end - def test_binary - thru_binary = nil - %w"and or + - * / % ** | ^ & <=> > >= < <= == === != =~ !~ << >> && ||".each do |op| + %w"and or + - * / % ** | ^ & <=> > >= < <= == === != =~ !~ << >> && ||".each do |op| + define_method("test_binary(#{op})") do thru_binary = false parse("a #{op} b", :on_binary) {thru_binary = true} assert_equal true, thru_binary