aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_files.rb1
-rw-r--r--test/ripper/test_parser_events.rb15
-rw-r--r--test/ripper/test_scanner_events.rb25
3 files changed, 34 insertions, 7 deletions
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index f96d12ac55..9304127608 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -13,6 +13,7 @@ class TestRipper_Generic < Test::Unit::TestCase
def test_parse_files
Find.find("#{SRCDIR}/lib", "#{SRCDIR}/ext", "#{SRCDIR}/sample", "#{SRCDIR}/test") {|n|
next if /\.rb\z/ !~ n || !File.file?(n)
+$stderr.print '#'
assert_nothing_raised { Parser.new(File.read(n)).parse }
}
end
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 2ca825bea1..ba24996f4b 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -1,12 +1,19 @@
-#
-# test_parser_events.rb
-#
-
require 'dummyparser'
require 'test/unit'
class TestRipper_ParserEvents < Test::Unit::TestCase
+ # should be enabled
+=begin
+ 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
+ end
+=end
+
def parse(str)
DummyParser.new(str).parse.to_s
end
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 05c2d37f3e..ab66e357b6 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -7,6 +7,13 @@ require 'test/unit'
class TestRipper_ScannerEvents < Test::Unit::TestCase
+ def test_event_coverage
+ dispatched = Ripper::SCANNER_EVENTS.map {|event,_| event }
+ dispatched.each do |e|
+ assert_equal true, respond_to?("test_#{e}", true), "event not tested: #{e}"
+ end
+ end
+
def scan(target, str)
sym = "on_#{target}".intern
Ripper.lex(str).select {|_,type,_| type == sym }.map {|_,_,tok| tok }
@@ -177,9 +184,9 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase
scan('embexpr_beg', "m(<<EOS)\n\#{expr}\nEOS")
end
-=begin
- # currently detected as "rbrace"
def test_embexpr_end
+=begin
+ # currently detected as "rbrace"
assert_equal [],
scan('embexpr_end', '')
assert_equal ['}'],
@@ -190,8 +197,8 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase
scan('embexpr_end', '%Q[#{expr}]')
assert_equal ['}'],
scan('embexpr_end', "m(<<EOS)\n\#{expr}\nEOS")
- end
=end
+ end
def test_embvar
assert_equal [],
@@ -781,4 +788,16 @@ class TestRipper_ScannerEvents < Test::Unit::TestCase
scan('CHAR', "@ivar")
end
+ def test_label
+ end
+
+ def test_lambda
+ end
+
+ def test_lambeg
+ end
+
+ def test_lambda_arg
+ end
+
end