Permalink
Browse files

CHANGE: Updated tests to Tryouts 2

  • Loading branch information...
1 parent c8a2917 commit 4cdf46fe228b8043dd93102d9ab23ff63fec6c6b @delano committed Feb 11, 2011
View
@@ -3,6 +3,8 @@ ATTIC, CHANGES
#### 0.5.3 (2011-02-11) ###############################
* FIXED: Don't redefine Object::NOMETACLASS
+* CHANGE: Updated tests to Tryouts 2
+
#### 0.5.2 (2010-02-15) ###############################
View
@@ -22,11 +22,6 @@
# Update --main to reflect the default page to display
s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.rdoc"]
- # = DEPENDENCIES =
- # Add all gem dependencies
- #s.add_dependency 'name1'
- #s.add_dependency 'name2', '>= 0.0.0'
-
# = MANIFEST =
# The complete list of files to be included in the release. When GitHub packages your gem,
# it doesn't allow you to run any command that accesses the filesystem. You will get an
View
@@ -1,13 +1,17 @@
-group "Mixins"
-library :attic, "lib"
+require 'attic'
-tryouts "Object" do
- if Tryouts.sysinfo.ruby == "1.9.1"
- drill "has metaclass", 'Object' do
- Object.new.metaclass.superclass.to_s
- end
- drill "has metametaclass", '#<Class:Object>' do
- Object.new.metametaclass.superclass.to_s
- end
- end
-end
+## has metaclass", 'Object' do
+if Tryouts.sysinfo.ruby.to_s == "1.9.1"
+ Object.new.metaclass.superclass.to_s
+else
+ 'Object'
+end
+#=> 'Object'
+
+## has metametaclass", '#<Class:Object>' do
+if Tryouts.sysinfo.ruby.to_s >= "1.9.1"
+ Object.new.metaclass.superclass.to_s
+else
+ '#<Class:Object>'
+end
+#=> 'Object'
View
@@ -1,43 +1,41 @@
-group "Attic"
-library :attic, "lib"
-tryouts "Basics" do
+require 'attic'
- drill "can extend Attic", true do
- class ::Worker
- extend Attic
- def kind() :true end
- end
- # 1.9 # 1.8
- Worker.methods.member?(:attic) || Worker.methods.member?('attic')
- end
+## can extend Attic
+class ::Worker
+ extend Attic
+ def kind() :true end
+end
+# 1.9 # 1.8
+Worker.methods.member?(:attic) || Worker.methods.member?('attic')
+#=> true
- drill "can't include Attic raises exception", :exception, RuntimeError do
- class ::Worker
- include Attic
- end
+## can't include Attic raises exception
+begin
+ class ::Worker
+ include Attic
end
+rescue => RuntimeError
+ :success
+end
+#=> :success
- drill "can define attic attribute", true do
- Worker.attic :size
- w = Worker.new
- #w.attic :size
- stash :instance_methods, Worker.instance_methods(false)
- stash :metamethods, Worker.methods.sort
- w.respond_to? :size
- end
-
- drill "can access attic attributes explicitly", 2 do
- w = Worker.new
- w.attic_variable_set :size, 2
- w.attic_variable_get :size
- end
+## can define attic attribute
+Worker.attic :size
+w = Worker.new
+#w.attic :size
+p Worker.instance_methods(false)
+p Worker.methods.sort
+w.respond_to? :size
+#=> true
- drill "won't define a method if on already exists", :true do
- Worker.attic :kind
- a = Worker.new
- a.kind
- end
+## can access attic attributes explicitly"
+w = Worker.new
+w.attic_variable_set :size, 2
+w.attic_variable_get :size
+#=> 2
-end
-
-
+## won't define a method if on already exists
+Worker.attic :kind
+a = Worker.new
+a.kind
+#=> :true
@@ -1,34 +1,29 @@
-group "Attic"
-library :attic, "lib"
-tryouts "Setting and Getting" do
+require 'attic'
+class ::Worker
+ extend Attic
+ attic :size
+end
+
- setup do
- class ::Worker
- extend Attic
- attic :size
- end
- end
+## save an instance variable the long way
+w = Worker.new
+w.metametaclass.instance_variable_set '@mattress', 'S&F'
+w.metametaclass.instance_variable_get '@mattress'
+#=> 'S&F'
- drill "save an instance variable the long way", 'S&F' do
- w = Worker.new
- w.metametaclass.instance_variable_set '@mattress', 'S&F'
- w.metametaclass.instance_variable_get '@mattress'
- end
+## save an instance variable the short way
+w = Worker.new
+w.size = :california_king
+w.size
+#=> :california_king
- drill "save an instance variable the short way", :california_king do
- w = Worker.new
- w.size = :california_king
- w.size
- end
+## new instances don't cross streams
+w = Worker.new
+w.size
+#=> nil
- drill "new instances don't cross streams", nil do
- w = Worker.new
- w.size
- end
-
- drill "instance variables are hidden", [] do
- w = Worker.new
- w.metametaclass.instance_variable_set '@mattress', 'S&F'
- w.instance_variables
- end
-end
+## instance variables are hidden
+w = Worker.new
+w.metametaclass.instance_variable_set '@mattress', 'S&F'
+w.instance_variables
+## []
View
@@ -1,38 +1,32 @@
-group "Attic"
-library :attic, "lib"
-tryouts "String Setting and Getting" do
+require 'attic'
- drill "String can extend Attic", true do
+## String can extend Attic
String.extend Attic
String.respond_to? :attic
- end
+#=> true
- drill "save an instance variable the long way", 'S&F' do
- s = ""
- s.metametaclass.instance_variable_set '@mattress', 'S&F'
- s.metametaclass.instance_variable_get '@mattress'
- end
+## save an instance variable the long way
+s = ""
+s.metametaclass.instance_variable_set '@mattress', 'S&F'
+s.metametaclass.instance_variable_get '@mattress'
+#=> 'S&F'
- drill "can create attributes", [:goodies] do
- String.attic :goodies
- end
+## can create attributes
+String.attic :goodies
+#=> [:goodies]
- drill "save an instance variable the short way", :california_king do
- s = ""
- s.goodies = :california_king
- stash :ivars, s.instance_variables
- stash :avars, s.attic_vars
- s.goodies
- end
+## save an instance variable the short way
+s = ""
+s.goodies = :california_king
+p s.instance_variables
+p s.attic_vars
+s.goodies
+#=> :california_king
- drill "String instances don't cross streams", false do
- String.extend Attic
- String.attic :name
- a = "any"
- a.name = :roger
- a.name == "".name
- end
-
-
-
-end
+## String instances don't cross streams
+String.extend Attic
+String.attic :name
+a = "any"
+a.name = :roger
+a.name == "".name
+#=> false
@@ -1,56 +1,51 @@
-group "No Meta Class"
-library :attic, "lib"
-tryouts "Basics" do
-
- dream :class, Array
- dream [Symbol, Fixnum]
- drill "has list of no metaclass classes" do
- Object::NOMETACLASS
- end
-
- dream :exception, NoMetaClass
- drill "Symbol metaclass raises exception" do
- :any.metaclass
- end
-
- drill "Symbol instances don't cross streams", [:roger, nil] do
- Symbol.extend Attic
- Symbol.attic :name
- a, b = :symbol1, :symbol2
- a.name = :roger
- [a.name, b.name]
- end
-
- drill "metaclass? method exists", true do
- Symbol.extend Attic
- :any.respond_to? :metaclass?
- end
-
- drill "metaclass? method is false for a Symbol", false do
- :any.metaclass?
- end
-
- dream [:@___attic_name]
- drill "A Symbol's attic vars appear in all_instance_variables" do
- Symbol.extend Attic
- Symbol.attic :name
- a, b = :symbol1, :symbol2
- a.name = :roger
- a.all_instance_variables
- end
-
- dream []
- drill "A Symbol's attic vars do not appear in instance_variables" do
- Symbol.extend Attic
- Symbol.attic :name
- a, b = :symbol1, :symbol2
- a.name = :roger
- a.instance_variables
- end
-
-
- drill "knows attic variables", [:name] do
- Symbol.attic_variables
- end
-
-end
+require 'attic'
+
+## has list of no metaclass classes
+Object::NOMETACLASS
+#=> [Symbol, Fixnum]
+
+## Symbol metaclass raises exception
+begin
+ :any.metaclass
+rescue NoMetaClass
+ :success
+end
+#=> :success
+
+## Symbol instances don't cross streams
+Symbol.extend Attic
+Symbol.attic :name
+a, b = :symbol1, :symbol2
+a.name = :roger
+[a.name, b.name]
+#=> [:roger, nil]
+
+## metaclass? method exists
+Symbol.extend Attic
+:any.respond_to? :metaclass?
+#=> true
+
+## metaclass? method is false for a Symbol", false do
+:any.metaclass?
+#=> false
+
+## A Symbol's attic vars appear in all_instance_variables" do
+Symbol.extend Attic
+Symbol.attic :name
+a, b = :symbol1, :symbol2
+a.name = :roger
+a.all_instance_variables
+#=> [:@___attic_name]
+
+
+## A Symbol's attic vars do not appear in instance_variables" do
+Symbol.extend Attic
+Symbol.attic :name
+a, b = :symbol1, :symbol2
+a.name = :roger
+a.instance_variables
+#=> []
+
+## knows attic variables", [:name] do
+Symbol.attic_variables
+#=> [:name]
Oops, something went wrong.

0 comments on commit 4cdf46f

Please sign in to comment.