Skip to content

Commit

Permalink
- some improvements in advanced attributes test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
canonic-epicure committed Nov 26, 2009
1 parent dcbea81 commit d94cb91
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
30 changes: 17 additions & 13 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
TASKS
IDEAS
=====

- 'immutable' builder

- implement optimization for methods/OVERRIDE modifiers w/o SUPER calls ) probably should be configurable, to avoid increasing of startup overhead

- some kind of obfuscator to reduce codebase size ?

- some kind of compiler to skip class construction stage (for immutable classes)?


TASKS
=====

- derive 'stable' branch

Expand Down Expand Up @@ -29,26 +40,20 @@ TASKS



CORE FEATURES
=============

- 'immutable' builder

- implement optimization for methods/OVERRIDE modifiers w/o SUPER calls ) probably should be configurable, to avoid increasing of startup overhead

- some kind of obfuscator to reduce codebase size


REFACTORING POSSIBILITIES
=========================

- refactor advanced attributes from roles to adding methods directly (should be well-test covered first)

- merge advanced attribute Role into bootstrap role

- merge bootstrap role into managed class


- if (this.hasAttribute('builderClass')) this.getBuiderTarget() - to create a separate builder class for each metaclass
- + stem
- needs a test


- move builderClass and stemClass to private attributes (with leading underscore)?

Expand All @@ -58,7 +63,6 @@ REFACTORING POSSIBILITIES

- metaclass as subclass of stem?


- convert all OVERRIDE modifiers in core to AROUND? (need to benchmark them 1st)


Expand All @@ -70,7 +74,7 @@ EXTENSIONS

- JooseX.Builder.Also (to address Rhino issues and allow multiple modifiers in the same class)

- JooseX.Role.Parameterized
- JooseX.Meta.Parameterized

- JooseX.Type

Expand Down
43 changes: 42 additions & 1 deletion t/052_advanced_attribute.t.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
StartTest(function (t) {

t.plan(4)
t.plan(10)

//==================================================================================================================================================================================
t.diag("Advanced attributes and class's body")
Expand All @@ -27,6 +27,47 @@ StartTest(function (t) {
t.ok(!Test.meta.stem.opened, "'Test' class has closed stem")

t.ok(bodyCalled, 'Body of class was called')


//==================================================================================================================================================================================
t.diag("Consumin of advanced attribute from Role")

Role('TestRole', {
has : {
res : {
is : 'rw',
init : 'advanced'
}
}
})

t.ok(TestRole.meta.hasAttribute('res'), "'res' attribute was added")


var advAttr = TestRole.meta.getAttribute('res')

t.ok(advAttr instanceof Joose.Managed.Attribute, "'res' attribute is a Joose.Managed.Attribute instance")

t.ok(advAttr.value == 'advanced', "Attribute has a correct initial value")



Class('TestClass', {

does : TestRole
})

t.ok(TestClass.meta.hasAttribute('res'), "Attribute 'res' was consumed from Role")

var advAttr1 = TestClass.meta.getAttribute('res')

t.ok(advAttr1 instanceof Joose.Managed.Attribute, "'res' attribute is advanced")

t.ok(advAttr1.value == 'advanced', "Attribute has a correct initial value")


t.ok(TestClass.meta.hasMethod('getRes'), "Getter method was created")
t.ok(TestClass.meta.hasMethod('setRes'), "Setter method was created")

})

0 comments on commit d94cb91

Please sign in to comment.