test/test_logging.rb in logging-0.6.3 vs test/test_logging.rb in logging-0.7.0

- old
+ new

@@ -1,6 +1,6 @@ -# $Id: test_logging.rb 88 2008-02-08 18:47:36Z tim_pease $ +# $Id: test_logging.rb 97 2008-02-13 00:32:18Z tim_pease $ require File.join(File.dirname(__FILE__), %w[setup]) module TestLogging @@ -116,11 +116,11 @@ 'a file descriptor -- not a file name' logger.close assert_equal 3, Dir.glob(@glob).length end - def test_define_levels_default + def test_init_default empty = {} assert_equal empty, @levels assert_equal empty, @lnames assert_same false, ::Logging.const_defined?(:MAX_LEVEL_LENGTH) @@ -141,19 +141,19 @@ assert_equal 'WARN', @lnames[2] assert_equal 'ERROR', @lnames[3] assert_equal 'FATAL', @lnames[4] end - def test_define_levels_special + def test_init_special empty = {} assert_equal empty, @levels assert_equal empty, @lnames assert_same false, ::Logging.const_defined?(:MAX_LEVEL_LENGTH) - assert_raise(ArgumentError) {::Logging.define_levels(1, 2, 3, 4)} + assert_raise(ArgumentError) {::Logging.init(1, 2, 3, 4)} - ::Logging.define_levels :one, 'two', :THREE, 'FoUr', :sIx + ::Logging.init :one, 'two', :THREE, 'FoUr', :sIx assert_equal 5, @levels.length assert_equal 5, @lnames.length assert_equal 5, ::Logging::MAX_LEVEL_LENGTH @@ -168,17 +168,17 @@ assert_equal 'THREE', @lnames[2] assert_equal 'FOUR', @lnames[3] assert_equal 'SIX', @lnames[4] end - def test_define_levels_all_off + def test_init_all_off empty = {} assert_equal empty, @levels assert_equal empty, @lnames assert_same false, ::Logging.const_defined?(:MAX_LEVEL_LENGTH) - ::Logging.define_levels %w(a b all c off d) + ::Logging.init %w(a b all c off d) assert_equal 4, @levels.length assert_equal 4, @lnames.length assert_equal 1, ::Logging::MAX_LEVEL_LENGTH @@ -231,9 +231,18 @@ ::Logging.format_as 'yaml' assert ::Logging.const_defined?('OBJ_FORMAT') assert_equal :yaml, ::Logging::OBJ_FORMAT remove_const[:OBJ_FORMAT] + end + + def test_path + path = ::Logging.path(*%w[one two three]) + assert_match %r/one\/two\/three$/, path + end + + def test_version + assert_match %r/\d+\.\d+\.\d+/, ::Logging.version end end # class TestLogging end # module TestLogging