File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -96,3 +96,42 @@ describe "class", ->
96
96
assert . same Thing . __name, " Thing"
97
97
assert . is_true Thing . __parent == Base
98
98
99
+ assert . is_true instance. __class == Thing
100
+
101
+ it " should have name when assigned" , ->
102
+ Thing = class
103
+ assert . same Thing . __name, " Thing"
104
+
105
+
106
+ it " should not expose class properties on instance" , ->
107
+ class Thing
108
+ @height : 10
109
+
110
+ Thing . color = " blue"
111
+
112
+ instance = Thing !
113
+ assert . same instance. color, nil
114
+ assert . same instance. height, nil
115
+
116
+ it " should expose new things added to __base" , ->
117
+ class Thing
118
+
119
+ instance = Thing !
120
+ Thing . __base. color = " green"
121
+
122
+ assert . same instance. color, " green"
123
+
124
+ it " should call with correct receiver" , ->
125
+ local instance
126
+
127
+ class Thing
128
+ is_class : => assert . is_true @ == Thing
129
+ is_instance : => assert . is_true @ == instance
130
+
131
+ go : =>
132
+ @@is_class !
133
+ @is_instance !
134
+
135
+ instance = Thing !
136
+ instance\ go!
137
+
You can’t perform that action at this time.
0 commit comments