test/rbbt/util/test_log.rb in rbbt-util-5.26.85 vs test/rbbt/util/test_log.rb in rbbt-util-5.26.86
- old
+ new
@@ -1,23 +1,54 @@
require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/util/log'
class TestLog < Test::Unit::TestCase
- def test_get_level
+ def _test_get_level
assert_equal 0, Log.get_level(:debug)
assert_equal 1, Log.get_level(:low)
assert_equal 1, Log.get_level("LOW")
assert_equal 1, Log.get_level(1)
assert_equal 0, Log.get_level(nil)
end
- def test_color
+ def _test_color
assert Log.color(:green, "green")
end
- def test_no_stderr
+ def _test_no_stderr
Log.ignore_stderr do
STDERR.puts "NOPRINT"
+ end
+ end
+
+ def _test_trap_stderr
+ Log.severity = 0
+ Log.trap_stderr do
+ STDERR.puts "NOPRINT"
+ STDERR.puts "NOPRINT"
+ STDERR.puts "NOPRINT"
+ STDOUT.puts "PRINT STDOUT"
+ STDOUT.puts "PRINT STDOUT"
+ end
+ Log.trap_stderr do
+ STDERR.puts "NOPRINT"
+ STDOUT.puts "PRINT STDOUT"
+ end
+ Log.trap_std do
+ STDERR.puts "NOPRINT"
+ STDOUT.puts "NOPRINT STDOUT"
+ end
+ end
+
+ def test_trap_std
+ Log.severity = 0
+ Log.trap_std do
+ STDERR.puts "NOPRINT STDERR"
+ STDOUT.puts "NOPRINT STDOUT"
+ end
+ Log.trap_std "OUT", "ERR", 4, 2 do
+ STDERR.puts "NOPRINT STDERR"
+ STDOUT.puts "NOPRINT STDOUT"
end
end
end