Sha256: eda058a0c9d582f16207ddb027e45d61c58a2720f69636f146375108be1813f3

Contents?: true

Size: 703 Bytes

Versions: 10

Compression:

Stored size: 703 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)
    output = ENV['SHOW_RUBY_PROF_PRINTER_OUTPUT'] == "1" ? STDOUT : ''
    printer.print(output)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
ruby-prof-0.10.8 test/singleton_test.rb
ruby-prof-0.10.7 test/singleton_test.rb
ruby-prof-0.10.6 test/singleton_test.rb
ruby-prof-0.10.5 test/singleton_test.rb
ruby-prof-0.10.4 test/singleton_test.rb
ruby-prof-0.10.2 test/singleton_test.rb
acunote-ruby-prof-0.9.2 test/singleton_test.rb
ruby-prof-0.9.2 test/singleton_test.rb
ruby-prof-0.9.1 test/singleton_test.rb
ruby-prof-0.9.0 test/singleton_test.rb