diff options
author | Sam Stephenson <sam@37signals.com> | 2005-11-07 00:37:32 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2005-11-07 00:37:32 +0000 |
commit | 645de3391276a654ab4a653f5bbe47efc5759b77 (patch) | |
tree | 66b9c0f839d25f34a0575c4034d3d01a71bd1175 /activesupport/test | |
parent | 49c801b71d425543ae88e171b969b3316f022c2a (diff) | |
download | rails-645de3391276a654ab4a653f5bbe47efc5759b77.tar.gz rails-645de3391276a654ab4a653f5bbe47efc5759b77.tar.bz2 rails-645de3391276a654ab4a653f5bbe47efc5759b77.zip |
Added Kernel#silence_stderr to silence stderr for the duration of the given block. Changed Kernel#` to print a message to stderr (like Unix) instead of raising Errno::ENOENT on Win32.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2899 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/kernel_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 7d1565157a..e2d89176b9 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -20,4 +20,14 @@ class KernelTest < Test::Unit::TestCase def test_silence_warnings_with_return_value assert_equal 1, silence_warnings { 1 } end + + def test_silence_stderr + old_stderr_position = STDERR.tell + silence_stderr { STDERR.puts 'hello world' } + assert_equal old_stderr_position, STDERR.tell + end + + def test_silence_stderr_with_return_value + assert_equal 1, silence_stderr { 1 } + end end |