aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test/unit/autorunner.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:08:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:08:04 +0000
commit73d77c8f572b760b4c868579188fc39f360151cb (patch)
tree3b5013c7ceed366ab596efd596feb3831f5fc02f /lib/test/unit/autorunner.rb
parentd05b3b1e4801903a3f6338af932be334049de1ed (diff)
downloadruby-73d77c8f572b760b4c868579188fc39f360151cb.tar.gz
* lib/test/unit/assertions.rb: Modules are allowed to rescue.
* lib/test/unit/autorunner.rb: show output_level in order. * lib/test/unit/collector/dir.rb: get rid of successive same directories in load path. * test/testunit/test_assertions.rb (test_assert_nothing_raised, test_assert_raise): test for modules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit/autorunner.rb')
-rw-r--r--lib/test/unit/autorunner.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/test/unit/autorunner.rb b/lib/test/unit/autorunner.rb
index 76c3100472..4eee7f654b 100644
--- a/lib/test/unit/autorunner.rb
+++ b/lib/test/unit/autorunner.rb
@@ -37,12 +37,12 @@ module Test
end,
}
- OUTPUT_LEVELS = {
- :silent => UI::SILENT,
- :progress => UI::PROGRESS_ONLY,
- :normal => UI::NORMAL,
- :verbose => UI::VERBOSE,
- }
+ OUTPUT_LEVELS = [
+ [:silent, UI::SILENT],
+ [:progress, UI::PROGRESS_ONLY],
+ [:normal, UI::NORMAL],
+ [:verbose, UI::VERBOSE],
+ ]
COLLECTORS = {
:objectspace => proc do |r|
@@ -95,10 +95,10 @@ module Test
o.banner << "\nUsage: #{$0} [options] [-- untouched arguments]"
o.on
- o.on('-r', '--runner=RUNNER', RUNNERS.keys,
+ o.on('-r', '--runner=RUNNER', RUNNERS,
"Use the given RUNNER.",
- "(" + keyword_display(RUNNERS.keys) + ")") do |r|
- @runner = RUNNERS[r]
+ "(" + keyword_display(RUNNERS) + ")") do |r|
+ @runner = r
end
if(@standalone)
@@ -138,10 +138,10 @@ module Test
end
end
- o.on('-v', '--verbose=[LEVEL]', OUTPUT_LEVELS.keys,
+ o.on('-v', '--verbose=[LEVEL]', OUTPUT_LEVELS,
"Set the output level (default is verbose).",
- "(" + keyword_display(OUTPUT_LEVELS.keys) + ")") do |l|
- @output_level = (l ? OUTPUT_LEVELS[l] : OUTPUT_LEVELS[:verbose])
+ "(" + keyword_display(OUTPUT_LEVELS) + ")") do |l|
+ @output_level = l || UI::VERBOSE
end
o.on('--',
@@ -174,7 +174,9 @@ module Test
end
def keyword_display(array)
- array.collect{|e| e.to_s.sub(/^(.)([A-Za-z]+)(?=\w*$)/, '\\1[\\2]')}.sort.join(", ")
+ list = array.collect {|e, *| e.to_s}
+ Array === array or list.sort!
+ list.collect {|e| e.sub(/^(.)([A-Za-z]+)(?=\w*$)/, '\\1[\\2]')}.join(", ")
end
def run