test/unit/test_tracy.rb in stack_tracy-0.1.2 vs test/unit/test_tracy.rb in stack_tracy-0.1.3

- old
+ new

@@ -55,44 +55,46 @@ it "should have the expected stack trace" do stack_tracy do puts "testing" end file, line = __FILE__, __LINE__ - 2 + st = File.expand_path("../../../lib/stack_tracy.rb", __FILE__) assert_equal [ - {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => Kernel, :method => "puts" , :call => "Kernel#puts"}, - {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "puts" , :call => "IO#puts" }, - {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, - {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, - {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, - {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, - {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "puts" , :call => "IO#puts" }, - {:event => "c-return", :file => file, :line => line, :singleton => false, :object => Kernel, :method => "puts" , :call => "Kernel#puts"} + {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => Kernel , :method => "puts" , :call => "Kernel#puts" }, + {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "puts" , :call => "IO#puts" }, + {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, + {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, + {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, + {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "write", :call => "IO#write" }, + {:event => "c-return", :file => file, :line => line, :singleton => false, :object => IO , :method => "puts" , :call => "IO#puts" }, + {:event => "c-return", :file => file, :line => line, :singleton => false, :object => Kernel , :method => "puts" , :call => "Kernel#puts" }, + {:event => "call" , :file => st , :line => 35 , :singleton => false, :object => StackTracy, :method => "stop" , :call => "StackTracy#stop" }, + {:event => "c-call" , :file => st , :line => 36 , :singleton => 0 , :object => StackTracy, :method => "_stop", :call => "StackTracy._stop"} ], StackTracy.stack_trace.collect{ |event_info| event_info.to_hash.tap do |hash| assert hash.delete(:nsec) hash.delete(:time) end } assert StackTracy.stack_trace.first.call? - assert !StackTracy.stack_trace.last.call? - assert !StackTracy.stack_trace.first.return? - assert StackTracy.stack_trace.last.return? StackTracy.config do |c| c.exclude = ["IO"] end stack_tracy do puts "testing" end file, line = __FILE__, __LINE__ - 2 assert_equal [ - {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => Kernel, :method => "puts" , :call => "Kernel#puts"}, - {:event => "c-return", :file => file, :line => line, :singleton => false, :object => Kernel, :method => "puts" , :call => "Kernel#puts"} + {:event => "c-call" , :file => file, :line => line, :singleton => false, :object => Kernel , :method => "puts" , :call => "Kernel#puts" }, + {:event => "c-return", :file => file, :line => line, :singleton => false, :object => Kernel , :method => "puts" , :call => "Kernel#puts" }, + {:event => "call" , :file => st , :line => 35 , :singleton => false, :object => StackTracy, :method => "stop" , :call => "StackTracy#stop" }, + {:event => "c-call" , :file => st , :line => 36 , :singleton => 0 , :object => StackTracy, :method => "_stop", :call => "StackTracy._stop"} ], StackTracy.stack_trace.collect{ |event_info| event_info.to_hash.tap do |hash| assert hash.delete(:nsec) hash.delete(:time) end @@ -103,10 +105,10 @@ end stack_tracy do puts "testing" end - assert_equal true, StackTracy.stack_trace.empty? + assert_equal 2, StackTracy.stack_trace.size end it "should return a printable version of the stack trace" do stack_tracy do puts "testing" \ No newline at end of file