Skip to content

Commit

Permalink
First parameter of assert is always what is expected.
Browse files Browse the repository at this point in the history
The other parameter is object which is asserted.
  • Loading branch information
voxik committed Jan 9, 2018
1 parent 4e04141 commit e64ed51
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testformatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ def test_simple_formatter
sf = SimpleFormatter.new
f = Logger.new('simple formatter')
event = LogEvent.new(0, f, nil, "some data")
assert_match(sf.format(event), /simple formatter/)
assert_match(/simple formatter/, sf.format(event))
end
def test_basic_formatter
b = BasicFormatter.new
f = Logger.new('fake formatter')
event = LogEvent.new(0, f, caller, "fake formatter")
event2 = LogEvent.new(0, f, nil, "fake formatter")
# this checks for tracing
assert_match(b.format(event), /in/)
assert_not_match(b.format(event2), /in/)
assert_match(/in/, b.format(event))
assert_not_match(/in/, b.format(event2))
e = ArgumentError.new("argerror")
e.set_backtrace ['backtrace']
event3 = LogEvent.new(0, f, nil, e)
assert_match(b.format(event3), /ArgumentError/)
assert_match(b.format(LogEvent.new(0,f,nil,[1,2,3])), /Array/)
assert_match(/ArgumentError/, b.format(event3))
assert_match(/Array/, b.format(LogEvent.new(0,f,nil,[1,2,3])))
end
end

0 comments on commit e64ed51

Please sign in to comment.