test/test_stackprof.rb in stackprof-0.2.11 vs test/test_stackprof.rb in stackprof-0.2.12

- old
+ new

@@ -117,9 +117,30 @@ assert_equal 0, $?.exitstatus assert_equal true, StackProf.running? end end + def foo(n = 10) + if n == 0 + StackProf.sample + return + end + foo(n - 1) + end + + def test_recursive_total_samples + profile = StackProf.run(mode: :cpu, raw: true) do + 10.times do + foo + end + end + + frame = profile[:frames].values.find do |frame| + frame[:name] == "StackProfTest#foo" + end + assert_equal 10, frame[:total_samples] + end + def test_gc profile = StackProf.run(interval: 100, raw: true) do 5.times do GC.start end