summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rwxr-xr-xsample/test.rb8
-rwxr-xr-xtool/rubytest.rb2
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 99d902af45..b1d554293d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* eval.c (rb_using_refinement): make the method table of an iclass
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
diff --git a/tool/rubytest.rb b/tool/rubytest.rb
index 08eada44b8..a19ce9271a 100755
--- a/tool/rubytest.rb
+++ b/tool/rubytest.rb
@@ -1,6 +1,6 @@
#! ./miniruby
-exit if defined?(CROSS_COMPILING)
+exit if defined?(CROSS_COMPILING) and CROSS_COMPILING
ruby = ENV["RUBY"]
unless ruby
load './rbconfig.rb'