Sha256: 74afc91c5549c529368e0b01faef834dd98dce7a89d12a3eef596ca90cecf0a2

Contents?: true

Size: 631 Bytes

Versions: 22

Compression:

Stored size: 631 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'ruby-prof'
require 'timeout'

# --  Test for bug [#5657]
# http://rubyforge.org/tracker/index.php?func=detail&aid=5657&group_id=1814&atid=7060


class A
  attr_accessor :as
  def initialize
    @as = []
    class << @as
      def <<(an_a)
        super
      end
    end
  end

  def <<(an_a)
    @as << an_a
  end
end

class SingletonTest < Test::Unit::TestCase
  def test_singleton
    result = RubyProf.profile do
      a = A.new
      a << :first_thing
      assert_equal(1, a.as.size)
    end
    printer = RubyProf::FlatPrinter.new(result)
    printer.print(STDOUT)
  end
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
adamh-ruby-prof-0.7.3 test/singleton_test.rb
ruby-prof-danielhoey-0.8.1 test/singleton_test.rb
ruby-prof-0.8.2 test/singleton_test.rb
ruby-prof-0.8.1-x86-mingw32 test/singleton_test.rb
ruby-prof-0.8.1-x86-mswin32 test/singleton_test.rb
ruby-prof-0.8.1 test/singleton_test.rb
ruby-prof-0.7.10 test/singleton_test.rb
ruby-prof-0.7.9 test/singleton_test.rb
ruby-prof-0.7.8 test/singleton_test.rb
ruby-prof-0.7.7 test/singleton_test.rb
ruby-prof-0.7.6 test/singleton_test.rb
ruby-prof-0.7.5 test/singleton_test.rb
ruby-prof-0.7.4 test/singleton_test.rb
rdp-ruby-prof-0.7.4 test/singleton_test.rb
ruby-prof-0.7.0-x86-mswin32-60 test/singleton_test.rb
ruby-prof-0.7.3-x86-mswin32-60 test/singleton_test.rb
ruby-prof-0.7.1-x86-mswin32-60 test/singleton_test.rb
ruby-prof-0.7.3 test/singleton_test.rb
ruby-prof-0.7.2-x86-mswin32-60 test/singleton_test.rb
ruby-prof-0.7.1 test/singleton_test.rb