diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-11 18:09:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-11 18:09:10 +0000 |
commit | 8dafe8c88df357cc1a26a6b565bf9efa625da204 (patch) | |
tree | fa8fdd5209bae71052a07f3f9ce488f634b84fde /sample | |
parent | a6455f2994994a44212eeb3693940065c5acbe7f (diff) | |
download | ruby-8dafe8c88df357cc1a26a6b565bf9efa625da204.tar.gz |
test.rb: show messages in one line
* sample/test.rb (Progress#initialize): add --verbose option and show
messages in one line unless --verbose is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rwxr-xr-x | sample/test.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sample/test.rb b/sample/test.rb index 26cf0a1d97..e81b9f3bf2 100755 --- a/sample/test.rb +++ b/sample/test.rb @@ -8,6 +8,7 @@ class Progress def initialize @color = nil @quiet = nil + @verbose = nil ARGV.each do |arg| case arg when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/ @@ -15,9 +16,12 @@ class Progress @color = $1 ? nil : !$2 when /\A-(q|-quiet)\z/ @quiet = true + when /\A-(v|-verbose)\z/ + @verbose = true end end @tty = STDERR.tty? && !STDOUT.tty? && /dumb/ !~ ENV["TERM"] + @eol = @tty && !@verbose ? "\r\e[K\r" : "\n" case @color when nil @color = @tty @@ -44,9 +48,9 @@ class Progress end def finish_string if @quiet - "\n" + @eol else - "#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}\n" + "#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}#{@eol}" end end def pass |