Sha256: 229add65e75abbad7e1cf82ac8ac566c7795ca1d2fad1ce854718c15e56d3834

Contents?: true

Size: 633 Bytes

Versions: 9

Compression:

Stored size: 633 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

9 entries across 9 versions & 2 rubygems

Version Path
jeremy-ruby-prof-0.6.1 test/singleton_test.rb
ruby-prof-0.5.2-mswin32 test/singleton_test.rb
ruby-prof-0.5.1-mswin32 test/singleton_test.rb
ruby-prof-0.5.0-mswin32 test/singleton_test.rb
ruby-prof-0.5.1 test/singleton_test.rb
ruby-prof-0.5.0 test/singleton_test.rb
ruby-prof-0.6.0 test/singleton_test.rb
ruby-prof-0.5.2 test/singleton_test.rb
ruby-prof-0.6.0-x86-mswin32-60 test/singleton_test.rb