ruby-changes:36070
From: nobu <ko1@a...>
Date: Mon, 27 Oct 2014 14:53:37 +0900 (JST)
Subject: [ruby-changes:36070] nobu:r48151 (trunk): test_parser_events.rb: split test_binary
nobu 2014-10-27 14:53:22 +0900 (Mon, 27 Oct 2014) New Revision: 48151 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48151 Log: test_parser_events.rb: split test_binary * test/ripper/test_parser_events.rb (test_binary): split for each operators. Modified files: trunk/test/ripper/test_parser_events.rb Index: test/ripper/test_parser_events.rb =================================================================== --- test/ripper/test_parser_events.rb (revision 48150) +++ test/ripper/test_parser_events.rb (revision 48151) @@ -9,13 +9,10 @@ end https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L9 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::U https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L246 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/