summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 22:24:53 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-01 22:24:53 +0000
commitf242cefc68e8755493a50aaf2a30943e85994d6d (patch)
tree362fd2e2ba34b31191f64b0bf49be2137c6396ff /test/rdoc
parent2ba9cdcee6b0b97999c74c6fb19cdae08edd0e25 (diff)
* lib/rdoc/parser.rb: Parse files with a -*- rdoc -*- modeline
* test/rdoc/test_rdoc_parser.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_parser.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb
index 581e811a5f..628d1bd1da 100644
--- a/test/rdoc/test_rdoc_parser.rb
+++ b/test/rdoc/test_rdoc_parser.rb
@@ -75,6 +75,20 @@ class TestRDocParser < RDoc::TestCase
end
end
+ def test_can_parse_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# README.EXT - -*- rdoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
+ io.puts
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_equal RDoc::Parser::Simple, @RP.can_parse(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
##
# Selenium hides a .jar file using a .txt extension.
@@ -83,6 +97,32 @@ class TestRDocParser < RDoc::TestCase
assert_nil @RP.can_parse(hidden_zip)
end
+ def test_check_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995"
+ io.puts
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_equal 'rdoc', @RP.check_modeline(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
+ def test_check_modeline_no_modeline
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "This document explains how to make extension libraries for Ruby."
+ end
+
+ assert_nil @RP.check_modeline(readme_ext)
+ ensure
+ File.unlink readme_ext
+ end
+
def test_class_for_binary
rp = @RP.dup