Sha256: d5b567dde2adf7b9ddc98f4f6549339736bca3ba86708fb8f02611143e843795

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

# describe "self in an eigenclass body (class << obj)" do
#   it "is TrueClass for true" do
#     class << true; self; end.should == TrueClass
#   end
#   
#   it "is FalseClass for false" do
#     class << false; self; end.should == FalseClass
#   end
#   
#   it "is NilClass for nil" do
#     class << nil; self; end.should == NilClass
#   end
#   
#   it "is a singleton Class instance" do
#     mock = Object.new
#     cls = class << mock; self; end
#     cls.is_a?(Class).should == true
#     # puts cls
#     # `console.log(#{cls});`
#   end
#   
#   it "is a Class for classes"
#   
#   it "inherits from Class for classes" do
#     temp = []
#     cls = class << Object; self; end
#     sc = cls
#     until sc.nil? || sc.superclass == sc
#       temp << sc
#       sc = sc.superclass
#     end
#     temp.should include(Class)
#   end
# end


# puts "testing eigenclass etc"
# 
# class EigenclassSpecTest
#   
#   def something=(something)
#     puts "setting something to #{something}"
#   end
# end
# 
# a = EigenclassSpecTest.new
# a.something = 100
# 
# a_class = class << a; self; end
# 
# a_class.define_method(:something=) do |value|
#   puts "setting something.."
#   super value
#   puts "did set something"
# end
# 
# # `console.log(#{a}['$something=']);`
# 
# a.something = 200

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.2 gems/core/spec/language/eigenclass_spec.rb
opal-0.3.1 gems/core/spec/language/eigenclass_spec.rb
opal-0.3.0 gems/core/spec/language/eigenclass_spec.rb
opal-0.2.2 opals/opal/opal/spec/language/eigenclass_spec.rb
opal-0.2.0 opals/opal/opal/spec/language/eigenclass_spec.rb
opal-0.1.0 opals/opal/spec/language/eigenclass_spec.rb