diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-11 04:58:27 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-11 04:58:27 +0000 |
commit | 3cf7a0a46037f32b95b5ffb358cb898233d5c5db (patch) | |
tree | 7a780b46eedb55daa761296005b163fdeea5f3e4 /activesupport/test/core_ext | |
parent | 4b53e26ef612d870a01e646c45bcc4198ad3bd1a (diff) | |
download | rails-3cf7a0a46037f32b95b5ffb358cb898233d5c5db.tar.gz rails-3cf7a0a46037f32b95b5ffb358cb898233d5c5db.tar.bz2 rails-3cf7a0a46037f32b95b5ffb358cb898233d5c5db.zip |
Added Kernel#silence_warnings and puts it into use throughout the framework
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2179 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/kernel_test.rb | 19 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb new file mode 100644 index 0000000000..d757362243 --- /dev/null +++ b/activesupport/test/core_ext/kernel_test.rb @@ -0,0 +1,19 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/kernel' + +class KernelTest < Test::Unit::TestCase + def test_silence_warnings + silence_warnings { assert_nil $VERBOSE } + assert_equal 1234, silence_warnings { 1234 } + end + + def test_silence_warnings_verbose_invariant + old_verbose = $VERBOSE + begin + silence_warnings { raise } + flunk + rescue + assert_equal old_verbose, $VERBOSE + end + end +end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index c1c1918817..15189a75b1 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -1,6 +1,7 @@ require 'test/unit' +require 'date' require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/string' -require File.dirname(__FILE__) + '/../../lib/active_support/misc' +require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/kernel' silence_warnings do require File.dirname(__FILE__) + '/../inflector_test' |