1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-10-27 05:53:22 +00:00
parent 202b4bbe81
commit ce9fc203d1

View file

@ -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|
define_method("test_binary(#{op})") do
thru_binary = false
parse("a #{op} b", :on_binary) {thru_binary = true}
assert_equal true, thru_binary