summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rdoc/test_rdoc_encoding.rb2
-rw-r--r--test/rdoc/test_rdoc_parser.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index 8b482b67f2..89277585ec 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -164,7 +164,7 @@ class TestRDocEncoding < RDoc::TestCase
RDoc::Encoding.set_encoding s
- assert_equal "# more comments", s
+ assert_equal "#!/bin/ruby\n# more comments", s
end
def test_class_set_encoding_bad
diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb
index 1058323457..5f3b786314 100644
--- a/test/rdoc/test_rdoc_parser.rb
+++ b/test/rdoc/test_rdoc_parser.rb
@@ -77,6 +77,19 @@ class TestRDocParser < RDoc::TestCase
end
end
+ def test_class_for_executable
+ temp_dir do
+ 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
+
+ assert_equal 'app', parser.file_name
+ end
+ end
+
def test_can_parse_modeline
readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}"