Sha256: ce8af1a0171970ffec1ebbe1cb0ff50b4e11c50c75ec9525c16904cd0e3b46ba

Contents?: true

Size: 760 Bytes

Versions: 26

Compression:

Stored size: 760 Bytes

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)
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 < 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

26 entries across 26 versions & 2 rubygems

Version Path
ruby-prof-1.5.0-x64-mingw-ucrt test/singleton_test.rb
ruby-prof-1.5.0 test/singleton_test.rb
ruby-prof-1.4.5-x64-mingw-ucrt test/singleton_test.rb
ruby-prof-1.4.5 test/singleton_test.rb
ruby-prof-1.4.4-x64-mingw-ucrt test/singleton_test.rb
ruby-prof-1.4.4 test/singleton_test.rb
ruby-prof-1.4.3-x64-mingw32 test/singleton_test.rb
ruby-prof-1.4.3 test/singleton_test.rb
ruby-prof-1.4.2-x64-mingw32 test/singleton_test.rb
ruby-prof-1.4.2 test/singleton_test.rb
ruby-prof-1.4.1-x64-mingw32 test/singleton_test.rb
ruby-prof-1.4.1 test/singleton_test.rb
ruby-prof-1.4.0-x64-mingw32 test/singleton_test.rb
ruby-prof-1.4.0 test/singleton_test.rb
ruby-prof-1.3.2 test/singleton_test.rb
ruby-prof-1.3.1-x64-mingw32 test/singleton_test.rb
ruby-prof-1.3.1 test/singleton_test.rb
ruby-prof-1.3.0-x64-mingw32 test/singleton_test.rb
ruby-prof-1.3.0 test/singleton_test.rb
ruby-prof-1.2.0 test/singleton_test.rb