test/test_layout.rb in logging-1.8.2 vs test/test_layout.rb in logging-2.0.0
- old
+ new
@@ -18,20 +18,20 @@
def test_initialize
obj_format = lambda {|l| l.instance_variable_get :@obj_format}
assert_equal :string, obj_format[@layout]
- @layout = ::Logging::Layout.new 'format_as' => 'blah'
+ @layout = ::Logging::Layout.new :format_as => 'blah'
assert_equal :string, obj_format[@layout]
@layout = ::Logging::Layout.new :format_as => :inspect
assert_equal :inspect, obj_format[@layout]
- @layout = ::Logging::Layout.new 'format_as' => :json
+ @layout = ::Logging::Layout.new :format_as => :json
assert_equal :json, obj_format[@layout]
- @layout = ::Logging::Layout.new 'format_as' => :yaml
+ @layout = ::Logging::Layout.new :format_as => :yaml
assert_equal :yaml, obj_format[@layout]
@layout = ::Logging::Layout.new
assert_equal :string, obj_format[@layout]
@@ -83,14 +83,10 @@
@layout = ::Logging::Layout.new :format_as => :yaml
r = @layout.format_obj obj
assert_match %r/\A<Array> \n--- ?\n- one\n- two\n- three\n- four\n/, r
r = @layout.format_obj Class
- if defined? YAML::ENGINE and YAML::ENGINE.yamler == 'psych'
- assert_equal "<Class> \n--- !ruby/class 'Class'\n", r
- else
- assert_equal "<Class> Class", r
- end
+ assert_match %r/\A<Class> (\n--- !ruby\/class ')?Class('\n)?/, r
end
def test_format_obj_without_backtrace
@layout = ::Logging::Layout.new :backtrace => 'off'