mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
a6455f2994
commit
8dafe8c88d
3 changed files with 12 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Dec 12 03:09:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* sample/test.rb (Progress#initialize): add --verbose option and show
|
||||||
|
messages in one line unless --verbose is given.
|
||||||
|
|
||||||
Wed Dec 12 01:47:02 2012 Shugo Maeda <shugo@ruby-lang.org>
|
Wed Dec 12 01:47:02 2012 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_using_refinement): make the method table of an iclass
|
* eval.c (rb_using_refinement): make the method table of an iclass
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Progress
|
||||||
def initialize
|
def initialize
|
||||||
@color = nil
|
@color = nil
|
||||||
@quiet = nil
|
@quiet = nil
|
||||||
|
@verbose = nil
|
||||||
ARGV.each do |arg|
|
ARGV.each do |arg|
|
||||||
case arg
|
case arg
|
||||||
when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/
|
when /\A--color(?:=(?:always|(auto)|(never)|(.*)))?\z/
|
||||||
|
@ -15,9 +16,12 @@ class Progress
|
||||||
@color = $1 ? nil : !$2
|
@color = $1 ? nil : !$2
|
||||||
when /\A-(q|-quiet)\z/
|
when /\A-(q|-quiet)\z/
|
||||||
@quiet = true
|
@quiet = true
|
||||||
|
when /\A-(v|-verbose)\z/
|
||||||
|
@verbose = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@tty = STDERR.tty? && !STDOUT.tty? && /dumb/ !~ ENV["TERM"]
|
@tty = STDERR.tty? && !STDOUT.tty? && /dumb/ !~ ENV["TERM"]
|
||||||
|
@eol = @tty && !@verbose ? "\r\e[K\r" : "\n"
|
||||||
case @color
|
case @color
|
||||||
when nil
|
when nil
|
||||||
@color = @tty
|
@color = @tty
|
||||||
|
@ -44,9 +48,9 @@ class Progress
|
||||||
end
|
end
|
||||||
def finish_string
|
def finish_string
|
||||||
if @quiet
|
if @quiet
|
||||||
"\n"
|
@eol
|
||||||
else
|
else
|
||||||
"#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}\n"
|
"#{@passed}#{@ok ? 'OK' : ''} #{$testnum}#{@reset}#{@eol}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def pass
|
def pass
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! ./miniruby
|
#! ./miniruby
|
||||||
|
|
||||||
exit if defined?(CROSS_COMPILING)
|
exit if defined?(CROSS_COMPILING) and CROSS_COMPILING
|
||||||
ruby = ENV["RUBY"]
|
ruby = ENV["RUBY"]
|
||||||
unless ruby
|
unless ruby
|
||||||
load './rbconfig.rb'
|
load './rbconfig.rb'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue