File: no_method_class_test.rb

package info (click to toggle)
ruby-prof 0.7.3-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 468 kB
  • sloc: ruby: 2,377; ansic: 1,431; makefile: 31
file content (13 lines) | stat: -rwxr-xr-x 402 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env ruby
require 'ruby-prof'

# Make sure this works with no class or method
result = RubyProf.profile do 
  sleep 1
end

methods = result.threads.values.first
global_method = methods.sort_by {|method| method.full_name}.first
if global_method.full_name != 'Global#[No method]'
  raise(RuntimeError, "Wrong method name.  Expected: Global#[No method].  Actual: #{global_method.full_name}")
end