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
ruby-prof-0.7.2 test/singleton_test.rb
ruby-prof-0.7.0 test/singleton_test.rb