test/test_logger.rb in logging-2.0.0 vs test/test_logger.rb in logging-2.1.0

- old
+ new

@@ -31,10 +31,20 @@ log.add(1, 'this should be logged') assert_equal " INFO A Logger : this should be logged\n", a1.readline assert_nil a1.readline assert_nil a2.readline + log.add(1) { "block style message" } + assert_equal " INFO A Logger : block style message\n", a1.readline + assert_nil a1.readline + assert_nil a2.readline + + log.add(1, nil, 'this should be logged (when used by Rails.logger.extend(ActiveSupport::Logger.broadcast())') + assert_equal " INFO A Logger : this should be logged (when used by Rails.logger.extend(ActiveSupport::Logger.broadcast())\n", a1.readline + assert_nil a1.readline + assert_nil a2.readline + log.add(2,[1,2,3,4]) assert_equal " WARN A Logger : <Array> #{[1,2,3,4]}\n", a1.readline assert_nil a1.readline assert_nil a2.readline @@ -74,10 +84,14 @@ end assert_nil a1.readline assert_nil a2.readline end + def test_add_block + + end + def test_add_appenders log = ::Logging::Logger.new 'A' appenders = lambda {log.instance_variable_get :@appenders} assert_equal [], appenders[] @@ -249,14 +263,17 @@ assert_equal "this is line six of the log file\n", a2.readline assert_nil a1.readline assert_nil a2.readline end - def test_inspect + def test_inspect_matches_default root = ::Logging::Logger.new :root - str = "<#{root.class.name}:0x%x name=\"#{root.name}\">" % root.object_id - assert_equal str, root.inspect + # `to_s` triggers the default inspect behavior + expected = root.to_s.match(/0x[a-f\d]+/)[0] + actual = root.inspect.match(/0x[a-f\d]+/)[0] + + assert_equal expected, actual end def test_level root = ::Logging::Logger.new :root log = ::Logging::Logger.new 'A'