File: exceptions_test.rb

package info (click to toggle)
ruby-prof 1.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 844 kB
  • sloc: ruby: 6,448; ansic: 2,707; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)

class ExceptionsTest < TestCase
  def test_profile
    result = begin
      RubyProf.profile do
        raise(RuntimeError, 'Test error')
      end
    rescue
    end
    assert_kind_of(RubyProf::Profile, result)
  end

  def test_profile_allows_exceptions
    assert_raises(RuntimeError) do
      RubyProf.profile(:allow_exceptions => true) do
        raise(RuntimeError, 'Test error')
      end
    end
  end
end