Sha256: 4fc5f7be4c211a8e1071d54c38a8dee57d941783f129ed0c43cc394fa4da7a93

Contents?: true

Size: 734 Bytes

Versions: 23

Compression:

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

23 entries across 21 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/ruby-prof-0.15.1/test/singleton_test.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/ruby-prof-0.15.1/test/singleton_test.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/ruby-prof-0.15.1/test/singleton_test.rb
ruby-prof-0.15.2 test/singleton_test.rb
ruby-prof-0.15.1 test/singleton_test.rb
ruby-prof-0.15.0 test/singleton_test.rb
ruby-prof-0.14.2 test/singleton_test.rb
ruby-prof-0.14.1 test/singleton_test.rb
ruby-prof-0.14.0 test/singleton_test.rb
ruby-prof-0.13.1 test/singleton_test.rb
ruby-prof-0.13.0 test/singleton_test.rb
ruby-prof-0.12.2 test/singleton_test.rb
ruby-prof-0.12.1-x86-mingw32 test/singleton_test.rb
ruby-prof-0.12.1 test/singleton_test.rb
ruby-prof-0.11.3 test/singleton_test.rb
ruby-prof-0.11.2-x86-mingw32 test/singleton_test.rb
ruby-prof-0.11.2 test/singleton_test.rb
ruby-prof-0.11.0.rc3-x86-mingw32 test/singleton_test.rb
ruby-prof-0.11.0.rc3 test/singleton_test.rb
ruby-prof-0.11.0.rc2-x86-mingw32 test/singleton_test.rb