aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_parser.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-04 06:16:13 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-04 06:16:13 +0000
commitf3b24b5b7f88ecfdefcd898f01ea1cfb2ee418f3 (patch)
treeab559843c641b0e40cead2df451d3fc39b56a517 /test/rdoc/test_rdoc_parser.rb
parent5a7c4d2a78f78804a0508c56fbdf26738251bb5b (diff)
downloadruby-f3b24b5b7f88ecfdefcd898f01ea1cfb2ee418f3.tar.gz
* lib/rdoc/cross_reference.rb: Fixed matching of C#=== or #===. RDoc
bug #164 * test/rdoc/test_rdoc_cross_reference.rb: Test for above. * lib/rdoc/parser/changelog.rb: Fixed parsing of dates. RDoc bug #165 * test/rdoc/test_rdoc_parser_changelog.rb: Test for above. * lib/rdoc/parser.rb: Fixed parsing multibyte files with incomplete characters at byte 1024. [ruby-trunk - Bug #6393] Fixed handling of -E. [ruby-trunk - Bug #6392] * test/rdoc/test_rdoc_options.rb: Test for above. * test/rdoc/test_rdoc_parser.rb: ditto. * test/rdoc/test_rdoc_parser_c.rb: ditto. * test/rdoc/test_rdoc_parser_changelog.rb: ditto. * test/rdoc/test_rdoc_parser_markdown.rb: ditto. * test/rdoc/test_rdoc_parser_rd.rb: ditto. * test/rdoc/test_rdoc_rdoc.rb: ditto. * lib/rdoc/tom_doc.rb: Fixed parsing of [] in TomDoc arguments list. RDoc bug #167 * test/rdoc/test_rdoc_tom_doc.rb: Test for above. * lib/rdoc.rb: Update version. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_parser.rb')
-rw-r--r--test/rdoc/test_rdoc_parser.rb62
1 files changed, 47 insertions, 15 deletions
diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb
index 5f3b786314..338693f97a 100644
--- a/test/rdoc/test_rdoc_parser.rb
+++ b/test/rdoc/test_rdoc_parser.rb
@@ -33,8 +33,18 @@ class TestRDocParser < RDoc::TestCase
end
def test_class_binary_large_japanese_rdoc
- file_name = File.expand_path '../test.ja.large.rdoc', __FILE__
- assert !@RP.binary?(file_name)
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ capture_io do
+ begin
+ extenc, Encoding.default_external =
+ Encoding.default_external, Encoding::US_ASCII
+ file_name = File.expand_path '../test.ja.largedoc', __FILE__
+ assert !@RP.binary?(file_name)
+ ensure
+ Encoding.default_external = extenc
+ end
+ end
end
def test_class_binary_japanese_rdoc
@@ -51,7 +61,7 @@ class TestRDocParser < RDoc::TestCase
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
- assert_nil @RP.can_parse(@binary_dat)
+ assert_equal @RP::Simple, @RP.can_parse(@binary_dat)
jtest_file_name = File.expand_path '../test.ja.txt', __FILE__
assert_equal @RP::Simple, @RP.can_parse(jtest_file_name)
@@ -61,20 +71,12 @@ class TestRDocParser < RDoc::TestCase
readme_file_name = File.expand_path '../README', __FILE__
assert_equal @RP::Simple, @RP.can_parse(readme_file_name)
- end
- def test_class_can_parse_forbidden
- skip 'chmod not supported' if Gem.win_platform?
-
- Tempfile.open 'forbidden' do |io|
- begin
- File.chmod 0000, io.path
+ jtest_largerdoc_file_name = File.expand_path '../test.ja.largedoc', __FILE__
+ assert_equal @RP::Simple, @RP.can_parse(jtest_largerdoc_file_name)
- assert_nil @RP.can_parse io.path
- ensure
- File.chmod 0400, io.path
- end
- end
+ @RP.alias_extension 'rdoc', 'largedoc'
+ assert_equal @RP::Simple, @RP.can_parse(jtest_largerdoc_file_name)
end
def test_class_for_executable
@@ -82,6 +84,7 @@ class TestRDocParser < RDoc::TestCase
content = "#!/usr/bin/env ruby -w\n"
open 'app', 'w' do |io| io.write content end
app = @store.add_file 'app'
+
parser = @RP.for app, 'app', content, @options, :stats
assert_kind_of RDoc::Parser::Ruby, parser
@@ -90,6 +93,23 @@ class TestRDocParser < RDoc::TestCase
end
end
+ def test_class_for_forbidden
+ skip 'chmod not supported' if Gem.win_platform?
+
+ Tempfile.open 'forbidden' do |io|
+ begin
+ File.chmod 0000, io.path
+ forbidden = @store.add_file io.path
+
+ parser = @RP.for forbidden, 'forbidden', '', @options, :stats
+
+ assert_nil parser
+ ensure
+ File.chmod 0400, io.path
+ end
+ end
+ end
+
def test_can_parse_modeline
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
@@ -126,6 +146,18 @@ class TestRDocParser < RDoc::TestCase
File.unlink readme_ext
end
+ def test_check_modeline_coding
+ readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"
+
+ open readme_ext, 'w' do |io|
+ io.puts "# -*- coding: utf-8 -*-"
+ end
+
+ assert_nil @RP.check_modeline readme_ext
+ ensure
+ File.unlink readme_ext
+ end
+
def test_check_modeline_with_other
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"