resin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +52 -0
- data/amber/css/amber.css +519 -0
- data/amber/css/documentation.css +84 -0
- data/amber/css/profstef.css +75 -0
- data/amber/css/style.css +313 -0
- data/amber/images/amber.png +0 -0
- data/amber/images/amber_small.png +0 -0
- data/amber/images/off.png +0 -0
- data/amber/images/offHover.png +0 -0
- data/amber/images/presentation.png +0 -0
- data/amber/images/profstef.png +0 -0
- data/amber/images/sprite.png +0 -0
- data/amber/images/tinylogo.png +0 -0
- data/amber/images/twitterwall.png +0 -0
- data/amber/js/Additional-Examples.deploy.js +15 -0
- data/amber/js/Additional-Examples.js +21 -0
- data/amber/js/Benchfib.deploy.js +132 -0
- data/amber/js/Benchfib.js +167 -0
- data/amber/js/Canvas.deploy.js +1304 -0
- data/amber/js/Canvas.js +1885 -0
- data/amber/js/Compiler.deploy.js +1871 -0
- data/amber/js/Compiler.js +2616 -0
- data/amber/js/Documentation.deploy.js +961 -0
- data/amber/js/Documentation.js +1376 -0
- data/amber/js/Examples.deploy.js +53 -0
- data/amber/js/Examples.js +73 -0
- data/amber/js/IDE.deploy.js +3468 -0
- data/amber/js/IDE.js +4883 -0
- data/amber/js/Kernel-Announcements.deploy.js +107 -0
- data/amber/js/Kernel-Announcements.js +152 -0
- data/amber/js/Kernel-Classes.deploy.js +675 -0
- data/amber/js/Kernel-Classes.js +956 -0
- data/amber/js/Kernel-Collections.deploy.js +3273 -0
- data/amber/js/Kernel-Collections.js +4644 -0
- data/amber/js/Kernel-Exceptions.deploy.js +244 -0
- data/amber/js/Kernel-Exceptions.js +349 -0
- data/amber/js/Kernel-Methods.deploy.js +510 -0
- data/amber/js/Kernel-Methods.js +739 -0
- data/amber/js/Kernel-Objects.deploy.js +2698 -0
- data/amber/js/Kernel-Objects.js +3858 -0
- data/amber/js/Kernel-Tests.deploy.js +1419 -0
- data/amber/js/Kernel-Tests.js +1929 -0
- data/amber/js/Kernel-Transcript.deploy.js +142 -0
- data/amber/js/Kernel-Transcript.js +202 -0
- data/amber/js/SUnit.deploy.js +351 -0
- data/amber/js/SUnit.js +501 -0
- data/amber/js/amber.js +250 -0
- data/amber/js/boot.js +587 -0
- data/amber/js/compat.js +22 -0
- data/amber/js/init.js +8 -0
- data/amber/js/lib/CodeMirror/LICENSE +19 -0
- data/amber/js/lib/CodeMirror/amber.css +21 -0
- data/amber/js/lib/CodeMirror/codemirror.css +67 -0
- data/amber/js/lib/CodeMirror/codemirror.js +2144 -0
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -0
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
- data/amber/js/lib/jQuery/jquery.textarea.js +267 -0
- data/amber/js/lib/peg-0.6.2.min.js +2 -0
- data/amber/js/lib/showdown.js +419 -0
- data/amber/js/parser.js +4005 -0
- data/amber/js/parser.pegjs +220 -0
- data/amber/st/Benchfib.st +124 -0
- data/amber/st/Canvas.st +556 -0
- data/amber/st/Compiler.st +1425 -0
- data/amber/st/Documentation.st +758 -0
- data/amber/st/Examples.st +38 -0
- data/amber/st/IDE.st +2336 -0
- data/amber/st/Kernel-Announcements.st +61 -0
- data/amber/st/Kernel-Classes.st +403 -0
- data/amber/st/Kernel-Collections.st +1673 -0
- data/amber/st/Kernel-Exceptions.st +124 -0
- data/amber/st/Kernel-Methods.st +287 -0
- data/amber/st/Kernel-Objects.st +1489 -0
- data/amber/st/Kernel-Tests.st +892 -0
- data/amber/st/Kernel-Transcript.st +70 -0
- data/amber/st/SUnit.st +172 -0
- data/bin/runresin +12 -0
- data/lib/resin.rb +0 -0
- data/lib/resin/app/app.rb +121 -0
- data/lib/resin/app/views/index.haml +10 -0
- metadata +216 -0
@@ -0,0 +1,1929 @@
|
|
1
|
+
smalltalk.addPackage('Kernel-Tests', {});
|
2
|
+
smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
3
|
+
smalltalk.addMethod(
|
4
|
+
unescape('_testJoin'),
|
5
|
+
smalltalk.method({
|
6
|
+
selector: unescape('testJoin'),
|
7
|
+
category: 'tests',
|
8
|
+
fn: function (){
|
9
|
+
var self=this;
|
10
|
+
smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
|
11
|
+
return self;},
|
12
|
+
args: [],
|
13
|
+
source: unescape('testJoin%0A%09self%20assert%3A%20%27hello%2Cworld%27%20equals%3A%20%28%27%2C%27%20join%3A%20%23%28%27hello%27%20%27world%27%29%29'),
|
14
|
+
messageSends: ["assert:equals:", "join:"],
|
15
|
+
referencedClasses: []
|
16
|
+
}),
|
17
|
+
smalltalk.StringTest);
|
18
|
+
|
19
|
+
smalltalk.addMethod(
|
20
|
+
unescape('_testStreamContents'),
|
21
|
+
smalltalk.method({
|
22
|
+
selector: unescape('testStreamContents'),
|
23
|
+
category: 'tests',
|
24
|
+
fn: function (){
|
25
|
+
var self=this;
|
26
|
+
smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
|
27
|
+
return self;},
|
28
|
+
args: [],
|
29
|
+
source: unescape('testStreamContents%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28String%20streamContents%3A%20%5B%3AaStream%7C%20aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27hello%27%3B%20space%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27world%27%5D%29'),
|
30
|
+
messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
|
31
|
+
referencedClasses: ["String"]
|
32
|
+
}),
|
33
|
+
smalltalk.StringTest);
|
34
|
+
|
35
|
+
smalltalk.addMethod(
|
36
|
+
unescape('_testIncludesSubString'),
|
37
|
+
smalltalk.method({
|
38
|
+
selector: unescape('testIncludesSubString'),
|
39
|
+
category: 'tests',
|
40
|
+
fn: function (){
|
41
|
+
var self=this;
|
42
|
+
smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
|
43
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
|
44
|
+
return self;},
|
45
|
+
args: [],
|
46
|
+
source: unescape('testIncludesSubString%0A%09self%20assert%3A%20%28%27amber%27%20includesSubString%3A%20%27ber%27%29.%0A%09self%20deny%3A%20%28%27amber%27%20includesSubString%3A%20%27zork%27%29.'),
|
47
|
+
messageSends: ["assert:", "includesSubString:", "deny:"],
|
48
|
+
referencedClasses: []
|
49
|
+
}),
|
50
|
+
smalltalk.StringTest);
|
51
|
+
|
52
|
+
smalltalk.addMethod(
|
53
|
+
unescape('_testEquality'),
|
54
|
+
smalltalk.method({
|
55
|
+
selector: unescape('testEquality'),
|
56
|
+
category: 'tests',
|
57
|
+
fn: function (){
|
58
|
+
var self=this;
|
59
|
+
smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
|
60
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
|
61
|
+
smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
|
62
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
|
63
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
|
64
|
+
return self;},
|
65
|
+
args: [],
|
66
|
+
source: unescape('testEquality%0A%09self%20assert%3A%20%27hello%27%20%3D%20%27hello%27.%0A%09self%20deny%3A%20%27hello%27%20%3D%20%27world%27.%0A%0A%09self%20assert%3A%20%27hello%27%20%20%3D%20%27hello%27%20yourself.%0A%09self%20assert%3A%20%27hello%27%20yourself%20%3D%20%27hello%27.%0A%0A%09%22test%20JS%20falsy%20value%22%0A%09self%20deny%3A%20%27%27%20%3D%200'),
|
67
|
+
messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
|
68
|
+
referencedClasses: []
|
69
|
+
}),
|
70
|
+
smalltalk.StringTest);
|
71
|
+
|
72
|
+
smalltalk.addMethod(
|
73
|
+
unescape('_testCopyWithoutAll'),
|
74
|
+
smalltalk.method({
|
75
|
+
selector: unescape('testCopyWithoutAll'),
|
76
|
+
category: 'tests',
|
77
|
+
fn: function (){
|
78
|
+
var self=this;
|
79
|
+
smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
|
80
|
+
return self;},
|
81
|
+
args: [],
|
82
|
+
source: unescape('testCopyWithoutAll%0A%09self%20%0A%09%09assert%3A%20%27hello%20world%27%20%0A%09%09equals%3A%20%28%27*hello*%20*world*%27%20copyWithoutAll%3A%20%27*%27%29'),
|
83
|
+
messageSends: ["assert:equals:", "copyWithoutAll:"],
|
84
|
+
referencedClasses: []
|
85
|
+
}),
|
86
|
+
smalltalk.StringTest);
|
87
|
+
|
88
|
+
smalltalk.addMethod(
|
89
|
+
unescape('_testAt'),
|
90
|
+
smalltalk.method({
|
91
|
+
selector: unescape('testAt'),
|
92
|
+
category: 'tests',
|
93
|
+
fn: function (){
|
94
|
+
var self=this;
|
95
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
|
96
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
|
97
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
|
98
|
+
return self;},
|
99
|
+
args: [],
|
100
|
+
source: unescape('testAt%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%201%29%20%3D%20%27h%27.%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%205%29%20%3D%20%27o%27.%0A%09self%20assert%3A%20%28%27hello%27%20at%3A%206%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20nil'),
|
101
|
+
messageSends: ["assert:", unescape("%3D"), "at:", "at:ifAbsent:"],
|
102
|
+
referencedClasses: []
|
103
|
+
}),
|
104
|
+
smalltalk.StringTest);
|
105
|
+
|
106
|
+
smalltalk.addMethod(
|
107
|
+
unescape('_testAtPut'),
|
108
|
+
smalltalk.method({
|
109
|
+
selector: unescape('testAtPut'),
|
110
|
+
category: 'tests',
|
111
|
+
fn: function (){
|
112
|
+
var self=this;
|
113
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
|
114
|
+
return self;},
|
115
|
+
args: [],
|
116
|
+
source: unescape('testAtPut%0A%09%22String%20instances%20are%20read-only%22%0A%09self%20should%3A%20%5B%27hello%27%20at%3A%201%20put%3A%20%27a%27%5D%20raise%3A%20Error'),
|
117
|
+
messageSends: ["should:raise:", "at:put:"],
|
118
|
+
referencedClasses: ["Error"]
|
119
|
+
}),
|
120
|
+
smalltalk.StringTest);
|
121
|
+
|
122
|
+
smalltalk.addMethod(
|
123
|
+
unescape('_testSize'),
|
124
|
+
smalltalk.method({
|
125
|
+
selector: unescape('testSize'),
|
126
|
+
category: 'tests',
|
127
|
+
fn: function (){
|
128
|
+
var self=this;
|
129
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
|
130
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
|
131
|
+
return self;},
|
132
|
+
args: [],
|
133
|
+
source: unescape('testSize%0A%09self%20assert%3A%20%27smalltalk%27%20size%20equals%3A%209.%0A%09self%20assert%3A%20%27%27%20size%20equals%3A%200'),
|
134
|
+
messageSends: ["assert:equals:", "size"],
|
135
|
+
referencedClasses: []
|
136
|
+
}),
|
137
|
+
smalltalk.StringTest);
|
138
|
+
|
139
|
+
smalltalk.addMethod(
|
140
|
+
unescape('_testAddRemove'),
|
141
|
+
smalltalk.method({
|
142
|
+
selector: unescape('testAddRemove'),
|
143
|
+
category: 'tests',
|
144
|
+
fn: function (){
|
145
|
+
var self=this;
|
146
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
|
147
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
|
148
|
+
return self;},
|
149
|
+
args: [],
|
150
|
+
source: unescape('testAddRemove%0A%09self%20should%3A%20%5B%27hello%27%20add%3A%20%27a%27%5D%20raise%3A%20Error.%0A%09self%20should%3A%20%5B%27hello%27%20remove%3A%20%27h%27%5D%20raise%3A%20Error'),
|
151
|
+
messageSends: ["should:raise:", "add:", "remove:"],
|
152
|
+
referencedClasses: ["Error"]
|
153
|
+
}),
|
154
|
+
smalltalk.StringTest);
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
159
|
+
smalltalk.addMethod(
|
160
|
+
unescape('_testPrintString'),
|
161
|
+
smalltalk.method({
|
162
|
+
selector: unescape('testPrintString'),
|
163
|
+
category: 'tests',
|
164
|
+
fn: function (){
|
165
|
+
var self=this;
|
166
|
+
smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
|
167
|
+
return self;},
|
168
|
+
args: [],
|
169
|
+
source: unescape('testPrintString%0A%09self%0A%09%09assert%3A%20%27a%20Dictionary%28%27%27firstname%27%27%20-%3E%20%27%27James%27%27%20%2C%20%27%27lastname%27%27%20-%3E%20%27%27Bond%27%27%29%27%20%0A%09%09equals%3A%20%28Dictionary%20new%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27firstname%27%20put%3A%20%27James%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09at%3A%27lastname%27%20put%3A%20%27Bond%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09printString%29'),
|
170
|
+
messageSends: ["assert:equals:", "at:put:", "printString", "new"],
|
171
|
+
referencedClasses: ["Dictionary"]
|
172
|
+
}),
|
173
|
+
smalltalk.DictionaryTest);
|
174
|
+
|
175
|
+
smalltalk.addMethod(
|
176
|
+
unescape('_testEquality'),
|
177
|
+
smalltalk.method({
|
178
|
+
selector: unescape('testEquality'),
|
179
|
+
category: 'tests',
|
180
|
+
fn: function (){
|
181
|
+
var self=this;
|
182
|
+
var d1=nil;
|
183
|
+
var d2=nil;
|
184
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
|
185
|
+
(d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
|
186
|
+
(d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
|
187
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
|
188
|
+
(d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
|
189
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
|
190
|
+
(d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
|
191
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
|
192
|
+
(d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
|
193
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
|
194
|
+
return self;},
|
195
|
+
args: [],
|
196
|
+
source: unescape('testEquality%0A%09%7C%20d1%20d2%20%7C%0A%0A%09self%20assert%3A%20Dictionary%20new%20%3D%20Dictionary%20new.%0A%09%09%0A%09d1%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20yourself.%0A%09self%20assert%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%203%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%202%20put%3A%202%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.%0A%0A%09d2%20%3A%3D%20Dictionary%20new%20at%3A%201%20put%3A%202%3B%20at%3A%203%20put%3A%204%3B%20yourself.%0A%09self%20deny%3A%20d1%20%3D%20d2.'),
|
197
|
+
messageSends: ["assert:", unescape("%3D"), "new", "at:put:", "yourself", "deny:"],
|
198
|
+
referencedClasses: ["Dictionary"]
|
199
|
+
}),
|
200
|
+
smalltalk.DictionaryTest);
|
201
|
+
|
202
|
+
smalltalk.addMethod(
|
203
|
+
unescape('_testDynamicDictionaries'),
|
204
|
+
smalltalk.method({
|
205
|
+
selector: unescape('testDynamicDictionaries'),
|
206
|
+
category: 'tests',
|
207
|
+
fn: function (){
|
208
|
+
var self=this;
|
209
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
|
210
|
+
return self;},
|
211
|
+
args: [],
|
212
|
+
source: unescape('testDynamicDictionaries%0A%09self%20assert%3A%20%23%7B%27hello%27%20-%3E%201%7D%20asDictionary%20%3D%20%28Dictionary%20with%3A%20%27hello%27%20-%3E%201%29'),
|
213
|
+
messageSends: ["assert:", unescape("%3D"), "asDictionary", unescape("-%3E"), "with:"],
|
214
|
+
referencedClasses: ["Dictionary"]
|
215
|
+
}),
|
216
|
+
smalltalk.DictionaryTest);
|
217
|
+
|
218
|
+
smalltalk.addMethod(
|
219
|
+
unescape('_testAccessing'),
|
220
|
+
smalltalk.method({
|
221
|
+
selector: unescape('testAccessing'),
|
222
|
+
category: 'tests',
|
223
|
+
fn: function (){
|
224
|
+
var self=this;
|
225
|
+
var d=nil;
|
226
|
+
(d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
|
227
|
+
smalltalk.send(d, "_at_put_", ["hello", "world"]);
|
228
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
|
229
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
|
230
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
|
231
|
+
smalltalk.send(d, "_at_put_", [(1), (2)]);
|
232
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
|
233
|
+
smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
|
234
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
|
235
|
+
return self;},
|
236
|
+
args: [],
|
237
|
+
source: unescape('testAccessing%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%0A%09d%20at%3A%20%27hello%27%20put%3A%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%29%20%3D%20%27world%27.%0A%09self%20assert%3A%20%28d%20at%3A%20%27hello%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%09self%20deny%3A%20%28d%20at%3A%20%27foo%27%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20%27world%27.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20%28d%20at%3A%201%29%20%3D%202.%0A%0A%09d%20at%3A%201@3%20put%3A%203.%0A%09self%20assert%3A%20%28d%20at%3A%201@3%29%20%3D%203'),
|
238
|
+
messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "at:", "at:ifAbsent:", "deny:", unescape("@")],
|
239
|
+
referencedClasses: ["Dictionary"]
|
240
|
+
}),
|
241
|
+
smalltalk.DictionaryTest);
|
242
|
+
|
243
|
+
smalltalk.addMethod(
|
244
|
+
unescape('_testSize'),
|
245
|
+
smalltalk.method({
|
246
|
+
selector: unescape('testSize'),
|
247
|
+
category: 'tests',
|
248
|
+
fn: function (){
|
249
|
+
var self=this;
|
250
|
+
var d=nil;
|
251
|
+
(d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
|
252
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
|
253
|
+
smalltalk.send(d, "_at_put_", [(1), (2)]);
|
254
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
|
255
|
+
smalltalk.send(d, "_at_put_", [(2), (3)]);
|
256
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
|
257
|
+
return self;},
|
258
|
+
args: [],
|
259
|
+
source: unescape('testSize%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09self%20assert%3A%20d%20size%20%3D%200.%0A%0A%09d%20at%3A%201%20put%3A%202.%0A%09self%20assert%3A%20d%20size%20%3D%201.%0A%0A%09d%20at%3A%202%20put%3A%203.%0A%09self%20assert%3A%20d%20size%20%3D%202.'),
|
260
|
+
messageSends: ["new", "assert:", unescape("%3D"), "size", "at:put:"],
|
261
|
+
referencedClasses: ["Dictionary"]
|
262
|
+
}),
|
263
|
+
smalltalk.DictionaryTest);
|
264
|
+
|
265
|
+
smalltalk.addMethod(
|
266
|
+
unescape('_testValues'),
|
267
|
+
smalltalk.method({
|
268
|
+
selector: unescape('testValues'),
|
269
|
+
category: 'tests',
|
270
|
+
fn: function (){
|
271
|
+
var self=this;
|
272
|
+
var d=nil;
|
273
|
+
(d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
|
274
|
+
smalltalk.send(d, "_at_put_", [(1), (2)]);
|
275
|
+
smalltalk.send(d, "_at_put_", [(2), (3)]);
|
276
|
+
smalltalk.send(d, "_at_put_", [(3), (4)]);
|
277
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
|
278
|
+
return self;},
|
279
|
+
args: [],
|
280
|
+
source: unescape('testValues%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20values%20%3D%20%23%282%203%204%29'),
|
281
|
+
messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "values"],
|
282
|
+
referencedClasses: ["Dictionary"]
|
283
|
+
}),
|
284
|
+
smalltalk.DictionaryTest);
|
285
|
+
|
286
|
+
smalltalk.addMethod(
|
287
|
+
unescape('_testKeys'),
|
288
|
+
smalltalk.method({
|
289
|
+
selector: unescape('testKeys'),
|
290
|
+
category: 'tests',
|
291
|
+
fn: function (){
|
292
|
+
var self=this;
|
293
|
+
var d=nil;
|
294
|
+
(d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
|
295
|
+
smalltalk.send(d, "_at_put_", [(1), (2)]);
|
296
|
+
smalltalk.send(d, "_at_put_", [(2), (3)]);
|
297
|
+
smalltalk.send(d, "_at_put_", [(3), (4)]);
|
298
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
|
299
|
+
return self;},
|
300
|
+
args: [],
|
301
|
+
source: unescape('testKeys%0A%09%7C%20d%20%7C%0A%0A%09d%20%3A%3D%20Dictionary%20new.%0A%09d%20at%3A%201%20put%3A%202.%0A%09d%20at%3A%202%20put%3A%203.%0A%09d%20at%3A%203%20put%3A%204.%0A%0A%09self%20assert%3A%20d%20keys%20%3D%20%23%281%202%203%29'),
|
302
|
+
messageSends: ["new", "at:put:", "assert:", unescape("%3D"), "keys"],
|
303
|
+
referencedClasses: ["Dictionary"]
|
304
|
+
}),
|
305
|
+
smalltalk.DictionaryTest);
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
310
|
+
smalltalk.addMethod(
|
311
|
+
unescape('_testLogic'),
|
312
|
+
smalltalk.method({
|
313
|
+
selector: unescape('testLogic'),
|
314
|
+
category: 'tests',
|
315
|
+
fn: function (){
|
316
|
+
var self=this;
|
317
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
|
318
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
|
319
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
|
320
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
|
321
|
+
return self;},
|
322
|
+
args: [],
|
323
|
+
source: unescape('testLogic%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20assert%3A%20%28true%20%26%20true%29%3B%20deny%3A%20%28true%20%26%20false%29%3B%20deny%3A%20%28false%20%26%20true%29%3B%20deny%3A%20%28false%20%26%20false%29.%0A%09self%20assert%3A%20%28true%20%7C%20true%29%3B%20assert%3A%20%28true%20%7C%20false%29%3B%20assert%3A%20%28false%20%7C%20true%29%3B%20deny%3A%20%28false%20%7C%20false%29.%0A%20%20%20%20%20%20%20%20%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20assert%3A%20%28true%20%26%20%281%20%3E%200%29%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20false%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20%281%20%3E%202%29%29.%0A%20%20%20%20%20%20%20%20self%20assert%3A%20%28false%20%7C%20%281%20%3E%200%29%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20false%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20%281%20%3E%202%29%29'),
|
324
|
+
messageSends: ["assert:", unescape("%26"), "deny:", unescape("%7C"), unescape("%3E")],
|
325
|
+
referencedClasses: []
|
326
|
+
}),
|
327
|
+
smalltalk.BooleanTest);
|
328
|
+
|
329
|
+
smalltalk.addMethod(
|
330
|
+
unescape('_testEquality'),
|
331
|
+
smalltalk.method({
|
332
|
+
selector: unescape('testEquality'),
|
333
|
+
category: 'tests',
|
334
|
+
fn: function (){
|
335
|
+
var self=this;
|
336
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
|
337
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
|
338
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
|
339
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
|
340
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
|
341
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
|
342
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
|
343
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
|
344
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
|
345
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
|
346
|
+
return self;},
|
347
|
+
args: [],
|
348
|
+
source: unescape('testEquality%0A%09%22We%27re%20on%20top%20of%20JS...just%20be%20sure%20to%20check%20the%20basics%21%22%0A%0A%09self%20deny%3A%200%20%3D%20false.%20%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%20%27%27.%0A%0A%09self%20assert%3A%20true%20%3D%20true.%0A%09self%20deny%3A%20false%20%3D%20true.%0A%09self%20deny%3A%20true%20%3D%20false.%0A%09self%20assert%3A%20false%20%3D%20false.%0A%0A%09%22JS%20may%20do%20some%20type%20coercing%20after%20sending%20a%20message%22%0A%09self%20assert%3A%20true%20yourself%20%3D%20true.%0A%09self%20assert%3A%20true%20yourself%20%3D%20true%20yourself'),
|
349
|
+
messageSends: ["deny:", unescape("%3D"), "assert:", "yourself"],
|
350
|
+
referencedClasses: []
|
351
|
+
}),
|
352
|
+
smalltalk.BooleanTest);
|
353
|
+
|
354
|
+
smalltalk.addMethod(
|
355
|
+
unescape('_testLogicKeywords'),
|
356
|
+
smalltalk.method({
|
357
|
+
selector: unescape('testLogicKeywords'),
|
358
|
+
category: 'tests',
|
359
|
+
fn: function (){
|
360
|
+
var self=this;
|
361
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
|
362
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
|
363
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
|
364
|
+
(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
|
365
|
+
return self;},
|
366
|
+
args: [],
|
367
|
+
source: unescape('testLogicKeywords%0A%20%0A%09%22Trivial%20logic%20table%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%20true%5D%29%3B%20%0A%09%09deny%3A%20%28true%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20and%3A%20%5B%20false%20%5D%29.%0A%09self%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09assert%3A%20%28true%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%20true%20%5D%29%3B%20%0A%09%09deny%3A%20%28false%20or%3A%20%5B%20false%20%5D%29.%0A%20%20%20%20%20%20%20%20%0A%09%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20%0A%09%09assert%3A%20%28true%20and%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09deny%3A%20%28%281%20%3E%200%29%20and%3A%20%5B%201%20%3E%202%20%5D%29.%0A%20%20%20%20%20%20%20%20self%20%0A%09%09assert%3A%20%28false%20or%3A%20%5B%201%20%3E%200%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%20false%20%5D%29%3B%20%0A%09%09assert%3A%20%28%281%20%3E%200%29%20or%3A%20%5B%201%20%3E%202%20%5D%29'),
|
368
|
+
messageSends: ["assert:", "and:", "deny:", "or:", unescape("%3E")],
|
369
|
+
referencedClasses: []
|
370
|
+
}),
|
371
|
+
smalltalk.BooleanTest);
|
372
|
+
|
373
|
+
smalltalk.addMethod(
|
374
|
+
unescape('_testIfTrueIfFalse'),
|
375
|
+
smalltalk.method({
|
376
|
+
selector: unescape('testIfTrueIfFalse'),
|
377
|
+
category: 'tests',
|
378
|
+
fn: function (){
|
379
|
+
var self=this;
|
380
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
|
381
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
|
382
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
|
383
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
|
384
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
|
385
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
|
386
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
|
387
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
|
388
|
+
return self;},
|
389
|
+
args: [],
|
390
|
+
source: unescape('testIfTrueIfFalse%0A%20%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20nil.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28false%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.%0A%09self%20assert%3A%20%28false%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%0A%09self%20assert%3A%20%28true%20ifTrue%3A%20%5B%27alternative%20block%27%5D%20ifFalse%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block%27.%0A%09self%20assert%3A%20%28true%20ifFalse%3A%20%5B%27alternative%20block%27%5D%20ifTrue%3A%20%5B%27alternative%20block2%27%5D%29%20%3D%20%27alternative%20block2%27.'),
|
391
|
+
messageSends: ["assert:", unescape("%3D"), "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
|
392
|
+
referencedClasses: []
|
393
|
+
}),
|
394
|
+
smalltalk.BooleanTest);
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
399
|
+
smalltalk.addMethod(
|
400
|
+
unescape('_testPrintShowingDecimalPlaces'),
|
401
|
+
smalltalk.method({
|
402
|
+
selector: unescape('testPrintShowingDecimalPlaces'),
|
403
|
+
category: 'tests',
|
404
|
+
fn: function (){
|
405
|
+
var self=this;
|
406
|
+
smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
|
407
|
+
smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
|
408
|
+
smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
|
409
|
+
smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
|
410
|
+
smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
|
411
|
+
smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
|
412
|
+
smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
|
413
|
+
smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
|
414
|
+
smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
|
415
|
+
smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
|
416
|
+
smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
|
417
|
+
smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
|
418
|
+
smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
|
419
|
+
return self;},
|
420
|
+
args: [],
|
421
|
+
source: unescape('testPrintShowingDecimalPlaces%0A%09self%20assert%3A%20%2723.00%27%20equals%3A%20%2823%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%2723.57%27%20equals%3A%20%2823.5698%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-234.56700%27%20equals%3A%28%20234.567%20negated%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%2723%27%20equals%3A%20%2823.4567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%2724%27%20equals%3A%20%2823.5567%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-23%27%20equals%3A%20%2823.4567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27-24%27%20equals%3A%20%2823.5567%20negated%20printShowingDecimalPlaces%3A%200%29.%0A%09self%20assert%3A%20%27100000000.0%27%20equals%3A%20%28100000000%20printShowingDecimalPlaces%3A%201%29.%0A%09self%20assert%3A%20%270.98000%27%20equals%3A%20%280.98%20printShowingDecimalPlaces%3A%205%29.%0A%09self%20assert%3A%20%27-0.98%27%20equals%3A%20%280.98%20negated%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%272.57%27%20equals%3A%20%282.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%27-2.57%27%20equals%3A%20%28-2.567%20printShowingDecimalPlaces%3A%202%29.%0A%09self%20assert%3A%20%270.00%27%20equals%3A%20%280%20printShowingDecimalPlaces%3A%202%29.'),
|
422
|
+
messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
|
423
|
+
referencedClasses: []
|
424
|
+
}),
|
425
|
+
smalltalk.NumberTest);
|
426
|
+
|
427
|
+
smalltalk.addMethod(
|
428
|
+
unescape('_testEquality'),
|
429
|
+
smalltalk.method({
|
430
|
+
selector: unescape('testEquality'),
|
431
|
+
category: 'tests',
|
432
|
+
fn: function (){
|
433
|
+
var self=this;
|
434
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
|
435
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
|
436
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
|
437
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
|
438
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
|
439
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
|
440
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
|
441
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
|
442
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
|
443
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
|
444
|
+
return self;},
|
445
|
+
args: [],
|
446
|
+
source: unescape('testEquality%0A%09self%20assert%3A%201%20%3D%201.%0A%09self%20assert%3A%200%20%3D%200.%0A%09self%20deny%3A%201%20%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%201.%0A%09self%20assert%3A%201%20%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%200%20%3D%20false.%0A%09self%20deny%3A%20false%20%3D%200.%0A%09self%20deny%3A%20%27%27%20%3D%200.%0A%09self%20deny%3A%200%20%3D%20%27%27'),
|
447
|
+
messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
|
448
|
+
referencedClasses: []
|
449
|
+
}),
|
450
|
+
smalltalk.NumberTest);
|
451
|
+
|
452
|
+
smalltalk.addMethod(
|
453
|
+
unescape('_testArithmetic'),
|
454
|
+
smalltalk.method({
|
455
|
+
selector: unescape('testArithmetic'),
|
456
|
+
category: 'tests',
|
457
|
+
fn: function (){
|
458
|
+
var self=this;
|
459
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
|
460
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
|
461
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
|
462
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
|
463
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
|
464
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
|
465
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
|
466
|
+
return self;},
|
467
|
+
args: [],
|
468
|
+
source: unescape('testArithmetic%0A%09%0A%09%22We%20rely%20on%20JS%20here%2C%20so%20we%20won%27t%20test%20complex%20behavior%2C%20just%20check%20if%20%0A%09message%20sends%20are%20corrects%22%0A%0A%09self%20assert%3A%201.5%20+%201%20%3D%202.5.%0A%09self%20assert%3A%202%20-%201%20%3D%201.%0A%09self%20assert%3A%20-2%20-%201%20%3D%20-3.%0A%09self%20assert%3A%2012%20/%202%20%3D%206.%0A%09self%20assert%3A%203%20*%204%20%3D%2012.%0A%0A%09%22Simple%20parenthesis%20and%20execution%20order%22%0A%0A%09self%20assert%3A%201%20+%202%20*%203%20%3D%209.%0A%09self%20assert%3A%201%20+%20%282%20*%203%29%20%3D%207'),
|
469
|
+
messageSends: ["assert:", unescape("%3D"), unescape("+"), unescape("-"), unescape("/"), unescape("*")],
|
470
|
+
referencedClasses: []
|
471
|
+
}),
|
472
|
+
smalltalk.NumberTest);
|
473
|
+
|
474
|
+
smalltalk.addMethod(
|
475
|
+
unescape('_testRounded'),
|
476
|
+
smalltalk.method({
|
477
|
+
selector: unescape('testRounded'),
|
478
|
+
category: 'tests',
|
479
|
+
fn: function (){
|
480
|
+
var self=this;
|
481
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
|
482
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
|
483
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
|
484
|
+
return self;},
|
485
|
+
args: [],
|
486
|
+
source: unescape('testRounded%0A%09%0A%09self%20assert%3A%203%20rounded%20%3D%203.%0A%09self%20assert%3A%203.212%20rounded%20%3D%203.%0A%09self%20assert%3A%203.51%20rounded%20%3D%204'),
|
487
|
+
messageSends: ["assert:", unescape("%3D"), "rounded"],
|
488
|
+
referencedClasses: []
|
489
|
+
}),
|
490
|
+
smalltalk.NumberTest);
|
491
|
+
|
492
|
+
smalltalk.addMethod(
|
493
|
+
unescape('_testNegated'),
|
494
|
+
smalltalk.method({
|
495
|
+
selector: unescape('testNegated'),
|
496
|
+
category: 'tests',
|
497
|
+
fn: function (){
|
498
|
+
var self=this;
|
499
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
|
500
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
|
501
|
+
return self;},
|
502
|
+
args: [],
|
503
|
+
source: unescape('testNegated%0A%09self%20assert%3A%203%20negated%20%3D%20-3.%0A%09self%20assert%3A%20-3%20negated%20%3D%203'),
|
504
|
+
messageSends: ["assert:", unescape("%3D"), "negated"],
|
505
|
+
referencedClasses: []
|
506
|
+
}),
|
507
|
+
smalltalk.NumberTest);
|
508
|
+
|
509
|
+
smalltalk.addMethod(
|
510
|
+
unescape('_testComparison'),
|
511
|
+
smalltalk.method({
|
512
|
+
selector: unescape('testComparison'),
|
513
|
+
category: 'tests',
|
514
|
+
fn: function (){
|
515
|
+
var self=this;
|
516
|
+
smalltalk.send(self, "_assert_", [(3) > (2)]);
|
517
|
+
smalltalk.send(self, "_assert_", [(2) < (3)]);
|
518
|
+
smalltalk.send(self, "_deny_", [(3) < (2)]);
|
519
|
+
smalltalk.send(self, "_deny_", [(2) > (3)]);
|
520
|
+
smalltalk.send(self, "_assert_", [(3) >= (3)]);
|
521
|
+
smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
|
522
|
+
smalltalk.send(self, "_assert_", [(3) <= (3)]);
|
523
|
+
smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
|
524
|
+
return self;},
|
525
|
+
args: [],
|
526
|
+
source: unescape('testComparison%0A%0A%09self%20assert%3A%203%20%3E%202.%0A%09self%20assert%3A%202%20%3C%203.%0A%09%0A%09self%20deny%3A%203%20%3C%202.%0A%09self%20deny%3A%202%20%3E%203.%0A%0A%09self%20assert%3A%203%20%3E%3D%203.%0A%09self%20assert%3A%203.1%20%3E%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.%0A%09self%20assert%3A%203%20%3C%3D%203.1'),
|
527
|
+
messageSends: ["assert:", unescape("%3E"), unescape("%3C"), "deny:", unescape("%3E%3D"), unescape("%3C%3D")],
|
528
|
+
referencedClasses: []
|
529
|
+
}),
|
530
|
+
smalltalk.NumberTest);
|
531
|
+
|
532
|
+
smalltalk.addMethod(
|
533
|
+
unescape('_testTruncated'),
|
534
|
+
smalltalk.method({
|
535
|
+
selector: unescape('testTruncated'),
|
536
|
+
category: 'tests',
|
537
|
+
fn: function (){
|
538
|
+
var self=this;
|
539
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
|
540
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
|
541
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
|
542
|
+
return self;},
|
543
|
+
args: [],
|
544
|
+
source: unescape('testTruncated%0A%09%0A%09self%20assert%3A%203%20truncated%20%3D%203.%0A%09self%20assert%3A%203.212%20truncated%20%3D%203.%0A%09self%20assert%3A%203.51%20truncated%20%3D%203'),
|
545
|
+
messageSends: ["assert:", unescape("%3D"), "truncated"],
|
546
|
+
referencedClasses: []
|
547
|
+
}),
|
548
|
+
smalltalk.NumberTest);
|
549
|
+
|
550
|
+
smalltalk.addMethod(
|
551
|
+
unescape('_testCopying'),
|
552
|
+
smalltalk.method({
|
553
|
+
selector: unescape('testCopying'),
|
554
|
+
category: 'tests',
|
555
|
+
fn: function (){
|
556
|
+
var self=this;
|
557
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
|
558
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
|
559
|
+
return self;},
|
560
|
+
args: [],
|
561
|
+
source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%3D%201'),
|
562
|
+
messageSends: ["assert:", unescape("%3D%3D"), "copy", "deepCopy"],
|
563
|
+
referencedClasses: []
|
564
|
+
}),
|
565
|
+
smalltalk.NumberTest);
|
566
|
+
|
567
|
+
smalltalk.addMethod(
|
568
|
+
unescape('_testMinMax'),
|
569
|
+
smalltalk.method({
|
570
|
+
selector: unescape('testMinMax'),
|
571
|
+
category: 'tests',
|
572
|
+
fn: function (){
|
573
|
+
var self=this;
|
574
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
|
575
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
|
576
|
+
return self;},
|
577
|
+
args: [],
|
578
|
+
source: unescape('testMinMax%0A%09%0A%09self%20assert%3A%20%282%20max%3A%205%29%20equals%3A%205.%0A%09self%20assert%3A%20%282%20min%3A%205%29%20equals%3A%202'),
|
579
|
+
messageSends: ["assert:equals:", "max:", "min:"],
|
580
|
+
referencedClasses: []
|
581
|
+
}),
|
582
|
+
smalltalk.NumberTest);
|
583
|
+
|
584
|
+
smalltalk.addMethod(
|
585
|
+
unescape('_testIdentity'),
|
586
|
+
smalltalk.method({
|
587
|
+
selector: unescape('testIdentity'),
|
588
|
+
category: 'tests',
|
589
|
+
fn: function (){
|
590
|
+
var self=this;
|
591
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
|
592
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
|
593
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
|
594
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
|
595
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
|
596
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
|
597
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
|
598
|
+
return self;},
|
599
|
+
args: [],
|
600
|
+
source: unescape('testIdentity%0A%09self%20assert%3A%201%20%3D%3D%201.%0A%09self%20assert%3A%200%20%3D%3D%200.%0A%09self%20deny%3A%201%20%3D%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201.%0A%09self%20assert%3A%201%20%3D%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%201%20%3D%3D%202'),
|
601
|
+
messageSends: ["assert:", unescape("%3D%3D"), "deny:", "yourself"],
|
602
|
+
referencedClasses: []
|
603
|
+
}),
|
604
|
+
smalltalk.NumberTest);
|
605
|
+
|
606
|
+
smalltalk.addMethod(
|
607
|
+
unescape('_testSqrt'),
|
608
|
+
smalltalk.method({
|
609
|
+
selector: unescape('testSqrt'),
|
610
|
+
category: 'tests',
|
611
|
+
fn: function (){
|
612
|
+
var self=this;
|
613
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
|
614
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
|
615
|
+
return self;},
|
616
|
+
args: [],
|
617
|
+
source: unescape('testSqrt%0A%09%0A%09self%20assert%3A%204%20sqrt%20%3D%202.%0A%09self%20assert%3A%2016%20sqrt%20%3D%204'),
|
618
|
+
messageSends: ["assert:", unescape("%3D"), "sqrt"],
|
619
|
+
referencedClasses: []
|
620
|
+
}),
|
621
|
+
smalltalk.NumberTest);
|
622
|
+
|
623
|
+
smalltalk.addMethod(
|
624
|
+
unescape('_testSquared'),
|
625
|
+
smalltalk.method({
|
626
|
+
selector: unescape('testSquared'),
|
627
|
+
category: 'tests',
|
628
|
+
fn: function (){
|
629
|
+
var self=this;
|
630
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
|
631
|
+
return self;},
|
632
|
+
args: [],
|
633
|
+
source: unescape('testSquared%0A%09%0A%09self%20assert%3A%204%20squared%20%3D%2016'),
|
634
|
+
messageSends: ["assert:", unescape("%3D"), "squared"],
|
635
|
+
referencedClasses: []
|
636
|
+
}),
|
637
|
+
smalltalk.NumberTest);
|
638
|
+
|
639
|
+
smalltalk.addMethod(
|
640
|
+
unescape('_testTimesRepeat'),
|
641
|
+
smalltalk.method({
|
642
|
+
selector: unescape('testTimesRepeat'),
|
643
|
+
category: 'tests',
|
644
|
+
fn: function (){
|
645
|
+
var self=this;
|
646
|
+
var i=nil;
|
647
|
+
(i=(0));
|
648
|
+
smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
|
649
|
+
smalltalk.send(self, "_assert_equals_", [i, (0)]);
|
650
|
+
smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
|
651
|
+
smalltalk.send(self, "_assert_equals_", [i, (5)]);
|
652
|
+
return self;},
|
653
|
+
args: [],
|
654
|
+
source: unescape('testTimesRepeat%0A%09%7C%20i%20%7C%0A%0A%09i%20%3A%3D%200.%0A%090%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%200.%0A%0A%095%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205'),
|
655
|
+
messageSends: ["timesRepeat:", unescape("+"), "assert:equals:"],
|
656
|
+
referencedClasses: []
|
657
|
+
}),
|
658
|
+
smalltalk.NumberTest);
|
659
|
+
|
660
|
+
smalltalk.addMethod(
|
661
|
+
unescape('_testTo'),
|
662
|
+
smalltalk.method({
|
663
|
+
selector: unescape('testTo'),
|
664
|
+
category: 'tests',
|
665
|
+
fn: function (){
|
666
|
+
var self=this;
|
667
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
|
668
|
+
return self;},
|
669
|
+
args: [],
|
670
|
+
source: unescape('testTo%0A%09self%20assert%3A%20%281%20to%3A%205%29%20equals%3A%20%23%281%202%203%204%205%29'),
|
671
|
+
messageSends: ["assert:equals:", "to:"],
|
672
|
+
referencedClasses: []
|
673
|
+
}),
|
674
|
+
smalltalk.NumberTest);
|
675
|
+
|
676
|
+
smalltalk.addMethod(
|
677
|
+
unescape('_testToBy'),
|
678
|
+
smalltalk.method({
|
679
|
+
selector: unescape('testToBy'),
|
680
|
+
category: 'tests',
|
681
|
+
fn: function (){
|
682
|
+
var self=this;
|
683
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
|
684
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
|
685
|
+
return self;},
|
686
|
+
args: [],
|
687
|
+
source: unescape('testToBy%0A%09self%20assert%3A%20%280%20to%3A%206%20by%3A%202%29%20equals%3A%20%23%280%202%204%206%29.%0A%0A%09self%20should%3A%20%5B1%20to%3A%204%20by%3A%200%5D%20raise%3A%20Error'),
|
688
|
+
messageSends: ["assert:equals:", "to:by:", "should:raise:"],
|
689
|
+
referencedClasses: ["Error"]
|
690
|
+
}),
|
691
|
+
smalltalk.NumberTest);
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
696
|
+
smalltalk.addMethod(
|
697
|
+
unescape('_jsObject'),
|
698
|
+
smalltalk.method({
|
699
|
+
selector: unescape('jsObject'),
|
700
|
+
category: 'accessing',
|
701
|
+
fn: function (){
|
702
|
+
var self=this;
|
703
|
+
return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
|
704
|
+
return self;},
|
705
|
+
args: [],
|
706
|
+
source: unescape('jsObject%0A%09%3Creturn%20jsObject%20%3D%20%7Ba%3A%201%2C%20b%3A%20function%28%29%20%7Breturn%202%3B%7D%2C%20c%3A%20function%28object%29%20%7Breturn%20object%3B%7D%7D%3E'),
|
707
|
+
messageSends: [],
|
708
|
+
referencedClasses: []
|
709
|
+
}),
|
710
|
+
smalltalk.JSObjectProxyTest);
|
711
|
+
|
712
|
+
smalltalk.addMethod(
|
713
|
+
unescape('_testMethodWithArguments'),
|
714
|
+
smalltalk.method({
|
715
|
+
selector: unescape('testMethodWithArguments'),
|
716
|
+
category: 'tests',
|
717
|
+
fn: function (){
|
718
|
+
var self=this;
|
719
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
|
720
|
+
smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
|
721
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
|
722
|
+
smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
|
723
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
|
724
|
+
return self;},
|
725
|
+
args: [],
|
726
|
+
source: unescape('testMethodWithArguments%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20addClass%3A%20%27amber%27.%0A%09self%20assert%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.%0A%0A%09%27body%27%20asJQuery%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28%27body%27%20asJQuery%20hasClass%3A%20%27amber%27%29.'),
|
727
|
+
messageSends: ["deny:", "hasClass:", "asJQuery", "addClass:", "assert:", "removeClass:"],
|
728
|
+
referencedClasses: []
|
729
|
+
}),
|
730
|
+
smalltalk.JSObjectProxyTest);
|
731
|
+
|
732
|
+
smalltalk.addMethod(
|
733
|
+
unescape('_testYourself'),
|
734
|
+
smalltalk.method({
|
735
|
+
selector: unescape('testYourself'),
|
736
|
+
category: 'tests',
|
737
|
+
fn: function (){
|
738
|
+
var self=this;
|
739
|
+
var body=nil;
|
740
|
+
(body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
|
741
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
|
742
|
+
smalltalk.send(body, "_removeClass_", ["amber"]);
|
743
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
|
744
|
+
return self;},
|
745
|
+
args: [],
|
746
|
+
source: unescape('testYourself%0A%09%7Cbody%7C%0A%09body%20%3A%3D%20%27body%27%20asJQuery%0A%09%09%09%09addClass%3A%20%27amber%27%3B%0A%09%09%09%09yourself.%0A%0A%09self%20assert%3A%20%28body%20hasClass%3A%20%27amber%27%29.%0A%0A%09body%20removeClass%3A%20%27amber%27.%0A%09self%20deny%3A%20%28body%20hasClass%3A%20%27amber%27%29.'),
|
747
|
+
messageSends: ["addClass:", "yourself", "asJQuery", "assert:", "hasClass:", "removeClass:", "deny:"],
|
748
|
+
referencedClasses: []
|
749
|
+
}),
|
750
|
+
smalltalk.JSObjectProxyTest);
|
751
|
+
|
752
|
+
smalltalk.addMethod(
|
753
|
+
unescape('_testPropertyThatReturnsEmptyString'),
|
754
|
+
smalltalk.method({
|
755
|
+
selector: unescape('testPropertyThatReturnsEmptyString'),
|
756
|
+
category: 'tests',
|
757
|
+
fn: function (){
|
758
|
+
var self=this;
|
759
|
+
document.location.hash = '';
|
760
|
+
smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
|
761
|
+
smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
|
762
|
+
smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
|
763
|
+
return self;},
|
764
|
+
args: [],
|
765
|
+
source: unescape('testPropertyThatReturnsEmptyString%0A%09%3Cdocument.location.hash%20%3D%20%27%27%3E.%0A%09self%20assert%3A%20%27%27%20equals%3A%20document%20location%20hash.%0A%0A%09document%20location%20hash%3A%20%27test%27.%0A%09self%20assert%3A%20%27%23test%27%20equals%3A%20document%20location%20hash.'),
|
766
|
+
messageSends: ["assert:equals:", "hash", "location", "hash:"],
|
767
|
+
referencedClasses: []
|
768
|
+
}),
|
769
|
+
smalltalk.JSObjectProxyTest);
|
770
|
+
|
771
|
+
smalltalk.addMethod(
|
772
|
+
unescape('_testDNU'),
|
773
|
+
smalltalk.method({
|
774
|
+
selector: unescape('testDNU'),
|
775
|
+
category: 'tests',
|
776
|
+
fn: function (){
|
777
|
+
var self=this;
|
778
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
|
779
|
+
return self;},
|
780
|
+
args: [],
|
781
|
+
source: unescape('testDNU%0A%09self%20should%3A%20%5Bself%20jsObject%20foo%5D%20raise%3A%20MessageNotUnderstood'),
|
782
|
+
messageSends: ["should:raise:", "foo", "jsObject"],
|
783
|
+
referencedClasses: ["MessageNotUnderstood"]
|
784
|
+
}),
|
785
|
+
smalltalk.JSObjectProxyTest);
|
786
|
+
|
787
|
+
smalltalk.addMethod(
|
788
|
+
unescape('_testMessageSend'),
|
789
|
+
smalltalk.method({
|
790
|
+
selector: unescape('testMessageSend'),
|
791
|
+
category: 'tests',
|
792
|
+
fn: function (){
|
793
|
+
var self=this;
|
794
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
|
795
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
|
796
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
|
797
|
+
return self;},
|
798
|
+
args: [],
|
799
|
+
source: unescape('testMessageSend%0A%0A%09self%20assert%3A%20self%20jsObject%20a%20equals%3A%201.%0A%09self%20assert%3A%20self%20jsObject%20b%20equals%3A%202.%0A%09self%20assert%3A%20%28self%20jsObject%20c%3A%203%29%20equals%3A%203'),
|
800
|
+
messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
|
801
|
+
referencedClasses: []
|
802
|
+
}),
|
803
|
+
smalltalk.JSObjectProxyTest);
|
804
|
+
|
805
|
+
smalltalk.addMethod(
|
806
|
+
unescape('_testPrinting'),
|
807
|
+
smalltalk.method({
|
808
|
+
selector: unescape('testPrinting'),
|
809
|
+
category: 'tests',
|
810
|
+
fn: function (){
|
811
|
+
var self=this;
|
812
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", [unescape("%5Bobject%20Object%5D")])]);
|
813
|
+
return self;},
|
814
|
+
args: [],
|
815
|
+
source: unescape('testPrinting%0A%09self%20assert%3A%20self%20jsObject%20printString%20%3D%20%27%5Bobject%20Object%5D%27'),
|
816
|
+
messageSends: ["assert:", unescape("%3D"), "printString", "jsObject"],
|
817
|
+
referencedClasses: []
|
818
|
+
}),
|
819
|
+
smalltalk.JSObjectProxyTest);
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
|
824
|
+
smalltalk.addMethod(
|
825
|
+
unescape('_setUp'),
|
826
|
+
smalltalk.method({
|
827
|
+
selector: unescape('setUp'),
|
828
|
+
category: 'running',
|
829
|
+
fn: function (){
|
830
|
+
var self=this;
|
831
|
+
(self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
|
832
|
+
(self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
|
833
|
+
smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
|
834
|
+
(self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
|
835
|
+
(self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", [unescape("server/grul/js")]);smalltalk.send($rec, "_commitPathSt_", [unescape("grul/st")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
|
836
|
+
return self;},
|
837
|
+
args: [],
|
838
|
+
source: unescape('setUp%0A%09backUpCommitPathJs%20%3A%3D%20Package%20defaultCommitPathJs.%0A%09backUpCommitPathSt%20%3A%3D%20Package%20defaultCommitPathSt.%0A%0A%09Package%20resetCommitPaths.%0A%0A%09zorkPackage%20%3A%3D%20Package%20new%20name%3A%20%27Zork%27.%0A%09grulPackage%20%3A%3D%20Package%20new%20%0A%09%09%09%09%09name%3A%20%27Grul%27%3B%0A%09%09%09%09%09commitPathJs%3A%20%27server/grul/js%27%3B%0A%09%09%09%09%09commitPathSt%3A%20%27grul/st%27%3B%0A%09%09%09%09%09yourself'),
|
839
|
+
messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
|
840
|
+
referencedClasses: ["Package"]
|
841
|
+
}),
|
842
|
+
smalltalk.PackageTest);
|
843
|
+
|
844
|
+
smalltalk.addMethod(
|
845
|
+
unescape('_tearDown'),
|
846
|
+
smalltalk.method({
|
847
|
+
selector: unescape('tearDown'),
|
848
|
+
category: 'running',
|
849
|
+
fn: function (){
|
850
|
+
var self=this;
|
851
|
+
(function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
|
852
|
+
return self;},
|
853
|
+
args: [],
|
854
|
+
source: unescape('tearDown%0A%09%20Package%20%0A%09%09defaultCommitPathJs%3A%20backUpCommitPathJs%3B%0A%09%09defaultCommitPathSt%3A%20backUpCommitPathSt'),
|
855
|
+
messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
|
856
|
+
referencedClasses: ["Package"]
|
857
|
+
}),
|
858
|
+
smalltalk.PackageTest);
|
859
|
+
|
860
|
+
smalltalk.addMethod(
|
861
|
+
unescape('_testGrulCommitPathStShouldBeGrulSt'),
|
862
|
+
smalltalk.method({
|
863
|
+
selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
|
864
|
+
category: 'tests',
|
865
|
+
fn: function (){
|
866
|
+
var self=this;
|
867
|
+
smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
|
868
|
+
return self;},
|
869
|
+
args: [],
|
870
|
+
source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
|
871
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
872
|
+
referencedClasses: []
|
873
|
+
}),
|
874
|
+
smalltalk.PackageTest);
|
875
|
+
|
876
|
+
smalltalk.addMethod(
|
877
|
+
unescape('_testZorkCommitPathStShouldBeSt'),
|
878
|
+
smalltalk.method({
|
879
|
+
selector: unescape('testZorkCommitPathStShouldBeSt'),
|
880
|
+
category: 'tests',
|
881
|
+
fn: function (){
|
882
|
+
var self=this;
|
883
|
+
smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
|
884
|
+
return self;},
|
885
|
+
args: [],
|
886
|
+
source: unescape('testZorkCommitPathStShouldBeSt%0A%09self%20assert%3A%20%27st%27%20equals%3A%20zorkPackage%20commitPathSt'),
|
887
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
888
|
+
referencedClasses: []
|
889
|
+
}),
|
890
|
+
smalltalk.PackageTest);
|
891
|
+
|
892
|
+
smalltalk.addMethod(
|
893
|
+
unescape('_testZorkCommitPathJsShouldBeJs'),
|
894
|
+
smalltalk.method({
|
895
|
+
selector: unescape('testZorkCommitPathJsShouldBeJs'),
|
896
|
+
category: 'tests',
|
897
|
+
fn: function (){
|
898
|
+
var self=this;
|
899
|
+
smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
|
900
|
+
return self;},
|
901
|
+
args: [],
|
902
|
+
source: unescape('testZorkCommitPathJsShouldBeJs%0A%09self%20assert%3A%20%27js%27%20equals%3A%20zorkPackage%20commitPathJs'),
|
903
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
904
|
+
referencedClasses: []
|
905
|
+
}),
|
906
|
+
smalltalk.PackageTest);
|
907
|
+
|
908
|
+
smalltalk.addMethod(
|
909
|
+
unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
|
910
|
+
smalltalk.method({
|
911
|
+
selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
|
912
|
+
category: 'tests',
|
913
|
+
fn: function (){
|
914
|
+
var self=this;
|
915
|
+
smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
|
916
|
+
return self;},
|
917
|
+
args: [],
|
918
|
+
source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
|
919
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
920
|
+
referencedClasses: []
|
921
|
+
}),
|
922
|
+
smalltalk.PackageTest);
|
923
|
+
|
924
|
+
|
925
|
+
|
926
|
+
smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
|
927
|
+
smalltalk.addMethod(
|
928
|
+
unescape('_setUp'),
|
929
|
+
smalltalk.method({
|
930
|
+
selector: unescape('setUp'),
|
931
|
+
category: 'running',
|
932
|
+
fn: function (){
|
933
|
+
var self=this;
|
934
|
+
smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
|
935
|
+
(function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
|
936
|
+
return self;},
|
937
|
+
args: [],
|
938
|
+
source: unescape('setUp%0A%09super%20setUp.%0A%0A%09Package%0A%09%09defaultCommitPathJs%3A%20%27javascripts/%27%3B%0A%09%09defaultCommitPathSt%3A%20%27smalltalk/%27.'),
|
939
|
+
messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
|
940
|
+
referencedClasses: ["Package"]
|
941
|
+
}),
|
942
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
943
|
+
|
944
|
+
smalltalk.addMethod(
|
945
|
+
unescape('_testGrulCommitPathJsShouldBeServerGrulJs'),
|
946
|
+
smalltalk.method({
|
947
|
+
selector: unescape('testGrulCommitPathJsShouldBeServerGrulJs'),
|
948
|
+
category: 'tests',
|
949
|
+
fn: function (){
|
950
|
+
var self=this;
|
951
|
+
smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
|
952
|
+
return self;},
|
953
|
+
args: [],
|
954
|
+
source: unescape('testGrulCommitPathJsShouldBeServerGrulJs%0A%09self%20assert%3A%20%27server/grul/js%27%20equals%3A%20grulPackage%20commitPathJs'),
|
955
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
956
|
+
referencedClasses: []
|
957
|
+
}),
|
958
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
959
|
+
|
960
|
+
smalltalk.addMethod(
|
961
|
+
unescape('_testGrulCommitPathStShouldBeGrulSt'),
|
962
|
+
smalltalk.method({
|
963
|
+
selector: unescape('testGrulCommitPathStShouldBeGrulSt'),
|
964
|
+
category: 'tests',
|
965
|
+
fn: function (){
|
966
|
+
var self=this;
|
967
|
+
smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
|
968
|
+
return self;},
|
969
|
+
args: [],
|
970
|
+
source: unescape('testGrulCommitPathStShouldBeGrulSt%0A%09self%20assert%3A%20%27grul/st%27%20equals%3A%20grulPackage%20commitPathSt'),
|
971
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
972
|
+
referencedClasses: []
|
973
|
+
}),
|
974
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
975
|
+
|
976
|
+
smalltalk.addMethod(
|
977
|
+
unescape('_testZorkCommitPathJsShouldBeJavascript'),
|
978
|
+
smalltalk.method({
|
979
|
+
selector: unescape('testZorkCommitPathJsShouldBeJavascript'),
|
980
|
+
category: 'tests',
|
981
|
+
fn: function (){
|
982
|
+
var self=this;
|
983
|
+
smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
|
984
|
+
return self;},
|
985
|
+
args: [],
|
986
|
+
source: unescape('testZorkCommitPathJsShouldBeJavascript%0A%09self%20assert%3A%20%27javascripts/%27%20equals%3A%20zorkPackage%20commitPathJs'),
|
987
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
988
|
+
referencedClasses: []
|
989
|
+
}),
|
990
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
991
|
+
|
992
|
+
smalltalk.addMethod(
|
993
|
+
unescape('_testZorkCommitPathStShouldBeSmalltalk'),
|
994
|
+
smalltalk.method({
|
995
|
+
selector: unescape('testZorkCommitPathStShouldBeSmalltalk'),
|
996
|
+
category: 'tests',
|
997
|
+
fn: function (){
|
998
|
+
var self=this;
|
999
|
+
smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
|
1000
|
+
return self;},
|
1001
|
+
args: [],
|
1002
|
+
source: unescape('testZorkCommitPathStShouldBeSmalltalk%0A%09self%20assert%3A%20%27smalltalk/%27%20equals%3A%20zorkPackage%20commitPathSt'),
|
1003
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
1004
|
+
referencedClasses: []
|
1005
|
+
}),
|
1006
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
1007
|
+
|
1008
|
+
|
1009
|
+
smalltalk.addMethod(
|
1010
|
+
unescape('_shouldInheritSelectors'),
|
1011
|
+
smalltalk.method({
|
1012
|
+
selector: unescape('shouldInheritSelectors'),
|
1013
|
+
category: 'accessing',
|
1014
|
+
fn: function (){
|
1015
|
+
var self=this;
|
1016
|
+
return false;
|
1017
|
+
return self;},
|
1018
|
+
args: [],
|
1019
|
+
source: unescape('shouldInheritSelectors%0A%09%5E%20false'),
|
1020
|
+
messageSends: [],
|
1021
|
+
referencedClasses: []
|
1022
|
+
}),
|
1023
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
|
1024
|
+
|
1025
|
+
|
1026
|
+
smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1027
|
+
smalltalk.addMethod(
|
1028
|
+
unescape('_testValue'),
|
1029
|
+
smalltalk.method({
|
1030
|
+
selector: unescape('testValue'),
|
1031
|
+
category: 'tests',
|
1032
|
+
fn: function (){
|
1033
|
+
var self=this;
|
1034
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
|
1035
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
|
1036
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
|
1037
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
|
1038
|
+
return self;},
|
1039
|
+
args: [],
|
1040
|
+
source: unescape('testValue%0A%09self%20assert%3A%20%28%5B1+1%5D%20value%29%20equals%3A%202.%0A%09self%20assert%3A%20%28%5B%3Ax%20%7C%20x%20+1%5D%20value%3A%202%29%20equals%3A%203.%0A%09self%20assert%3A%20%28%5B%3Ax%20%3Ay%20%7C%20x*y%5D%20value%3A%202%20value%3A%204%29%20equals%3A%208.%20%0A%0A%09%22Arguments%20are%20optional%20in%20Amber.%20This%20isn%27t%20ANSI%20compliant.%22%0A%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%3Ac%20%7C%201%5D%20value%29%20equals%3A%201'),
|
1041
|
+
messageSends: ["assert:equals:", "value", unescape("+"), "value:", "value:value:", unescape("*")],
|
1042
|
+
referencedClasses: []
|
1043
|
+
}),
|
1044
|
+
smalltalk.BlockClosureTest);
|
1045
|
+
|
1046
|
+
smalltalk.addMethod(
|
1047
|
+
unescape('_testOnDo'),
|
1048
|
+
smalltalk.method({
|
1049
|
+
selector: unescape('testOnDo'),
|
1050
|
+
category: 'tests',
|
1051
|
+
fn: function (){
|
1052
|
+
var self=this;
|
1053
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
|
1054
|
+
return self;},
|
1055
|
+
args: [],
|
1056
|
+
source: unescape('testOnDo%0A%09self%20assert%3A%20%28%5BError%20new%20signal%5D%20on%3A%20Error%20do%3A%20%5B%3Aex%20%7C%20true%5D%29'),
|
1057
|
+
messageSends: ["assert:", "on:do:", "signal", "new"],
|
1058
|
+
referencedClasses: ["Error"]
|
1059
|
+
}),
|
1060
|
+
smalltalk.BlockClosureTest);
|
1061
|
+
|
1062
|
+
smalltalk.addMethod(
|
1063
|
+
unescape('_testEnsure'),
|
1064
|
+
smalltalk.method({
|
1065
|
+
selector: unescape('testEnsure'),
|
1066
|
+
category: 'tests',
|
1067
|
+
fn: function (){
|
1068
|
+
var self=this;
|
1069
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
|
1070
|
+
return self;},
|
1071
|
+
args: [],
|
1072
|
+
source: unescape('testEnsure%0A%09self%20assert%3A%20%28%5BError%20new%5D%20ensure%3A%20%5Btrue%5D%29'),
|
1073
|
+
messageSends: ["assert:", "ensure:", "new"],
|
1074
|
+
referencedClasses: ["Error"]
|
1075
|
+
}),
|
1076
|
+
smalltalk.BlockClosureTest);
|
1077
|
+
|
1078
|
+
smalltalk.addMethod(
|
1079
|
+
unescape('_testNumArgs'),
|
1080
|
+
smalltalk.method({
|
1081
|
+
selector: unescape('testNumArgs'),
|
1082
|
+
category: 'tests',
|
1083
|
+
fn: function (){
|
1084
|
+
var self=this;
|
1085
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
|
1086
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
|
1087
|
+
return self;},
|
1088
|
+
args: [],
|
1089
|
+
source: unescape('testNumArgs%0A%09self%20assert%3A%20%5B%5D%20numArgs%20equals%3A%200.%0A%09self%20assert%3A%20%5B%3Aa%20%3Ab%20%7C%20%5D%20numArgs%20equals%3A%202'),
|
1090
|
+
messageSends: ["assert:equals:", "numArgs"],
|
1091
|
+
referencedClasses: []
|
1092
|
+
}),
|
1093
|
+
smalltalk.BlockClosureTest);
|
1094
|
+
|
1095
|
+
smalltalk.addMethod(
|
1096
|
+
unescape('_testValueWithPossibleArguments'),
|
1097
|
+
smalltalk.method({
|
1098
|
+
selector: unescape('testValueWithPossibleArguments'),
|
1099
|
+
category: 'tests',
|
1100
|
+
fn: function (){
|
1101
|
+
var self=this;
|
1102
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
|
1103
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
|
1104
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
|
1105
|
+
return self;},
|
1106
|
+
args: [],
|
1107
|
+
source: unescape('testValueWithPossibleArguments%0A%09self%20assert%3A%20%28%5B1%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%201.%0A%09self%20assert%3A%20%28%5B%3Aa%20%7C%20a%20+%204%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%207.%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%7C%20a%20+%20b%5D%20valueWithPossibleArguments%3A%20%23%283%204%205%29%29%20equals%3A%207.'),
|
1108
|
+
messageSends: ["assert:equals:", "valueWithPossibleArguments:", unescape("+")],
|
1109
|
+
referencedClasses: []
|
1110
|
+
}),
|
1111
|
+
smalltalk.BlockClosureTest);
|
1112
|
+
|
1113
|
+
smalltalk.addMethod(
|
1114
|
+
unescape('_testWhileTrue'),
|
1115
|
+
smalltalk.method({
|
1116
|
+
selector: unescape('testWhileTrue'),
|
1117
|
+
category: 'tests',
|
1118
|
+
fn: function (){
|
1119
|
+
var self=this;
|
1120
|
+
var i=nil;
|
1121
|
+
(i=(0));
|
1122
|
+
(function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
1123
|
+
smalltalk.send(self, "_assert_equals_", [i, (5)]);
|
1124
|
+
(i=(0));
|
1125
|
+
(function(){while((function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
|
1126
|
+
smalltalk.send(self, "_assert_equals_", [i, (5)]);
|
1127
|
+
return self;},
|
1128
|
+
args: [],
|
1129
|
+
source: unescape('testWhileTrue%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3C%205%5D%20whileTrue%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3C%205%5D%20whileTrue.%0A%09self%20assert%3A%20i%20equals%3A%205'),
|
1130
|
+
messageSends: ["whileTrue:", unescape("%3C"), unescape("+"), "assert:equals:", "whileTrue"],
|
1131
|
+
referencedClasses: []
|
1132
|
+
}),
|
1133
|
+
smalltalk.BlockClosureTest);
|
1134
|
+
|
1135
|
+
smalltalk.addMethod(
|
1136
|
+
unescape('_testWhileFalse'),
|
1137
|
+
smalltalk.method({
|
1138
|
+
selector: unescape('testWhileFalse'),
|
1139
|
+
category: 'tests',
|
1140
|
+
fn: function (){
|
1141
|
+
var self=this;
|
1142
|
+
var i=nil;
|
1143
|
+
(i=(0));
|
1144
|
+
(function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
|
1145
|
+
smalltalk.send(self, "_assert_equals_", [i, (6)]);
|
1146
|
+
(i=(0));
|
1147
|
+
(function(){while(!(function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
|
1148
|
+
smalltalk.send(self, "_assert_equals_", [i, (6)]);
|
1149
|
+
return self;},
|
1150
|
+
args: [],
|
1151
|
+
source: unescape('testWhileFalse%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3E%205%5D%20whileFalse%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%206.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3E%205%5D%20whileFalse.%0A%09self%20assert%3A%20i%20equals%3A%206'),
|
1152
|
+
messageSends: ["whileFalse:", unescape("%3E"), unescape("+"), "assert:equals:", "whileFalse"],
|
1153
|
+
referencedClasses: []
|
1154
|
+
}),
|
1155
|
+
smalltalk.BlockClosureTest);
|
1156
|
+
|
1157
|
+
smalltalk.addMethod(
|
1158
|
+
unescape('_testCompiledSource'),
|
1159
|
+
smalltalk.method({
|
1160
|
+
selector: unescape('testCompiledSource'),
|
1161
|
+
category: 'tests',
|
1162
|
+
fn: function (){
|
1163
|
+
var self=this;
|
1164
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
|
1165
|
+
return self;},
|
1166
|
+
args: [],
|
1167
|
+
source: unescape('testCompiledSource%0A%09self%20assert%3A%20%28%5B1+1%5D%20compiledSource%20includesSubString%3A%20%27function%27%29'),
|
1168
|
+
messageSends: ["assert:", "includesSubString:", "compiledSource", unescape("+")],
|
1169
|
+
referencedClasses: []
|
1170
|
+
}),
|
1171
|
+
smalltalk.BlockClosureTest);
|
1172
|
+
|
1173
|
+
|
1174
|
+
|
1175
|
+
smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1176
|
+
smalltalk.addMethod(
|
1177
|
+
unescape('_testEquality'),
|
1178
|
+
smalltalk.method({
|
1179
|
+
selector: unescape('testEquality'),
|
1180
|
+
category: 'tests',
|
1181
|
+
fn: function (){
|
1182
|
+
var self=this;
|
1183
|
+
var o=nil;
|
1184
|
+
(o=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1185
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
|
1186
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
|
1187
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
|
1188
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
|
1189
|
+
return self;},
|
1190
|
+
args: [],
|
1191
|
+
source: unescape('testEquality%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%20o.%0A%09self%20assert%3A%20o%20yourself%20%3D%20o.%0A%09self%20assert%3A%20o%20%3D%20o%20yourself'),
|
1192
|
+
messageSends: ["new", "deny:", unescape("%3D"), "assert:", "yourself"],
|
1193
|
+
referencedClasses: ["Object"]
|
1194
|
+
}),
|
1195
|
+
smalltalk.ObjectTest);
|
1196
|
+
|
1197
|
+
smalltalk.addMethod(
|
1198
|
+
unescape('_testIdentity'),
|
1199
|
+
smalltalk.method({
|
1200
|
+
selector: unescape('testIdentity'),
|
1201
|
+
category: 'tests',
|
1202
|
+
fn: function (){
|
1203
|
+
var self=this;
|
1204
|
+
var o=nil;
|
1205
|
+
(o=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1206
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
|
1207
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
|
1208
|
+
return self;},
|
1209
|
+
args: [],
|
1210
|
+
source: unescape('testIdentity%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%3D%20o'),
|
1211
|
+
messageSends: ["new", "deny:", unescape("%3D%3D"), "assert:"],
|
1212
|
+
referencedClasses: ["Object"]
|
1213
|
+
}),
|
1214
|
+
smalltalk.ObjectTest);
|
1215
|
+
|
1216
|
+
smalltalk.addMethod(
|
1217
|
+
unescape('_testHalt'),
|
1218
|
+
smalltalk.method({
|
1219
|
+
selector: unescape('testHalt'),
|
1220
|
+
category: 'tests',
|
1221
|
+
fn: function (){
|
1222
|
+
var self=this;
|
1223
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
|
1224
|
+
return self;},
|
1225
|
+
args: [],
|
1226
|
+
source: unescape('testHalt%0A%09self%20should%3A%20%5BObject%20new%20halt%5D%20raise%3A%20Error'),
|
1227
|
+
messageSends: ["should:raise:", "halt", "new"],
|
1228
|
+
referencedClasses: ["Object", "Error"]
|
1229
|
+
}),
|
1230
|
+
smalltalk.ObjectTest);
|
1231
|
+
|
1232
|
+
smalltalk.addMethod(
|
1233
|
+
unescape('_testBasicAccess'),
|
1234
|
+
smalltalk.method({
|
1235
|
+
selector: unescape('testBasicAccess'),
|
1236
|
+
category: 'tests',
|
1237
|
+
fn: function (){
|
1238
|
+
var self=this;
|
1239
|
+
var o=nil;
|
1240
|
+
(o=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1241
|
+
smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
|
1242
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
|
1243
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
|
1244
|
+
return self;},
|
1245
|
+
args: [],
|
1246
|
+
source: unescape('testBasicAccess%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09o%20basicAt%3A%20%27a%27%20put%3A%201.%0A%09self%20assert%3A%20%28o%20basicAt%3A%20%27a%27%29%20equals%3A%201.%0A%09self%20assert%3A%20%28o%20basicAt%3A%20%27b%27%29%20equals%3A%20nil'),
|
1247
|
+
messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
|
1248
|
+
referencedClasses: ["Object"]
|
1249
|
+
}),
|
1250
|
+
smalltalk.ObjectTest);
|
1251
|
+
|
1252
|
+
smalltalk.addMethod(
|
1253
|
+
unescape('_testNilUndefined'),
|
1254
|
+
smalltalk.method({
|
1255
|
+
selector: unescape('testNilUndefined'),
|
1256
|
+
category: 'tests',
|
1257
|
+
fn: function (){
|
1258
|
+
var self=this;
|
1259
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
|
1260
|
+
return self;},
|
1261
|
+
args: [],
|
1262
|
+
source: unescape('testNilUndefined%0A%09%22nil%20in%20Smalltalk%20is%20the%20undefined%20object%20in%20JS%22%0A%0A%09self%20assert%3A%20nil%20%3D%20undefined'),
|
1263
|
+
messageSends: ["assert:", unescape("%3D")],
|
1264
|
+
referencedClasses: []
|
1265
|
+
}),
|
1266
|
+
smalltalk.ObjectTest);
|
1267
|
+
|
1268
|
+
smalltalk.addMethod(
|
1269
|
+
unescape('_testidentityHash'),
|
1270
|
+
smalltalk.method({
|
1271
|
+
selector: unescape('testidentityHash'),
|
1272
|
+
category: 'tests',
|
1273
|
+
fn: function (){
|
1274
|
+
var self=this;
|
1275
|
+
var o1=nil;
|
1276
|
+
var o2=nil;
|
1277
|
+
(o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1278
|
+
(o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1279
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
|
1280
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
|
1281
|
+
return self;},
|
1282
|
+
args: [],
|
1283
|
+
source: unescape('testidentityHash%0A%09%7C%20o1%20o2%20%7C%0A%09%0A%09o1%20%3A%3D%20Object%20new.%0A%09o2%20%3A%3D%20Object%20new.%0A%0A%09self%20assert%3A%20o1%20identityHash%20%3D%3D%20o1%20identityHash.%0A%09self%20deny%3A%20o1%20identityHash%20%3D%3D%20o2%20identityHash'),
|
1284
|
+
messageSends: ["new", "assert:", unescape("%3D%3D"), "identityHash", "deny:"],
|
1285
|
+
referencedClasses: ["Object"]
|
1286
|
+
}),
|
1287
|
+
smalltalk.ObjectTest);
|
1288
|
+
|
1289
|
+
smalltalk.addMethod(
|
1290
|
+
unescape('_testBasicPerform'),
|
1291
|
+
smalltalk.method({
|
1292
|
+
selector: unescape('testBasicPerform'),
|
1293
|
+
category: 'tests',
|
1294
|
+
fn: function (){
|
1295
|
+
var self=this;
|
1296
|
+
var o=nil;
|
1297
|
+
(o=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
1298
|
+
smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
|
1299
|
+
smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
|
1300
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
|
1301
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
|
1302
|
+
return self;},
|
1303
|
+
args: [],
|
1304
|
+
source: unescape('testBasicPerform%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09o%20basicAt%3A%20%27func%27%20put%3A%20%5B%27hello%27%5D.%09%0A%09o%20basicAt%3A%20%27func2%27%20put%3A%20%5B%3Aa%20%7C%20a%20+%201%5D.%0A%0A%09self%20assert%3A%20%28o%20basicPerform%3A%20%27func%27%29%09%20equals%3A%20%27hello%27.%0A%09self%20assert%3A%20%28o%20basicPerform%3A%20%27func2%27%20withArguments%3A%20%23%283%29%29%20equals%3A%204'),
|
1305
|
+
messageSends: ["new", "basicAt:put:", unescape("+"), "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
|
1306
|
+
referencedClasses: ["Object"]
|
1307
|
+
}),
|
1308
|
+
smalltalk.ObjectTest);
|
1309
|
+
|
1310
|
+
smalltalk.addMethod(
|
1311
|
+
unescape('_testIfNil'),
|
1312
|
+
smalltalk.method({
|
1313
|
+
selector: unescape('testIfNil'),
|
1314
|
+
category: 'tests',
|
1315
|
+
fn: function (){
|
1316
|
+
var self=this;
|
1317
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
|
1318
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
|
1319
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
|
1320
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
|
1321
|
+
smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
|
1322
|
+
return self;},
|
1323
|
+
args: [],
|
1324
|
+
source: unescape('testIfNil%0A%09self%20deny%3A%20Object%20new%20isNil.%0A%09self%20deny%3A%20%28Object%20new%20ifNil%3A%20%5Btrue%5D%29%20%3D%20true.%0A%09self%20assert%3A%20%28Object%20new%20ifNotNil%3A%20%5Btrue%5D%29%20%3D%20true.%0A%0A%09self%20assert%3A%20%28Object%20new%20ifNil%3A%20%5Bfalse%5D%20ifNotNil%3A%20%5Btrue%5D%29%20%3D%20true.%0A%09self%20assert%3A%20%28Object%20new%20ifNotNil%3A%20%5Btrue%5D%20ifNil%3A%20%5Bfalse%5D%29%20%3D%20true'),
|
1325
|
+
messageSends: ["deny:", "isNil", "new", unescape("%3D"), "ifNil:", "assert:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
|
1326
|
+
referencedClasses: ["Object"]
|
1327
|
+
}),
|
1328
|
+
smalltalk.ObjectTest);
|
1329
|
+
|
1330
|
+
smalltalk.addMethod(
|
1331
|
+
unescape('_testInstVars'),
|
1332
|
+
smalltalk.method({
|
1333
|
+
selector: unescape('testInstVars'),
|
1334
|
+
category: 'tests',
|
1335
|
+
fn: function (){
|
1336
|
+
var self=this;
|
1337
|
+
var o=nil;
|
1338
|
+
(o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
|
1339
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
|
1340
|
+
smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
|
1341
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
|
1342
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
|
1343
|
+
return self;},
|
1344
|
+
args: [],
|
1345
|
+
source: unescape('testInstVars%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20ObjectMock%20new.%0A%09self%20assert%3A%20%28o%20instVarAt%3A%20%23foo%29%20equals%3A%20nil.%0A%0A%09o%20instVarAt%3A%20%23foo%20put%3A%201.%0A%09self%20assert%3A%20%28o%20instVarAt%3A%20%23foo%29%20equals%3A%201.%0A%09self%20assert%3A%20%28o%20instVarAt%3A%20%27foo%27%29%20equals%3A%201'),
|
1346
|
+
messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
|
1347
|
+
referencedClasses: ["ObjectMock"]
|
1348
|
+
}),
|
1349
|
+
smalltalk.ObjectTest);
|
1350
|
+
|
1351
|
+
smalltalk.addMethod(
|
1352
|
+
unescape('_testYourself'),
|
1353
|
+
smalltalk.method({
|
1354
|
+
selector: unescape('testYourself'),
|
1355
|
+
category: 'tests',
|
1356
|
+
fn: function (){
|
1357
|
+
var self=this;
|
1358
|
+
var o=nil;
|
1359
|
+
(o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
|
1360
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
|
1361
|
+
return self;},
|
1362
|
+
args: [],
|
1363
|
+
source: unescape('testYourself%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20ObjectMock%20new.%0A%09self%20assert%3A%20o%20yourself%20%3D%3D%20o'),
|
1364
|
+
messageSends: ["new", "assert:", unescape("%3D%3D"), "yourself"],
|
1365
|
+
referencedClasses: ["ObjectMock"]
|
1366
|
+
}),
|
1367
|
+
smalltalk.ObjectTest);
|
1368
|
+
|
1369
|
+
smalltalk.addMethod(
|
1370
|
+
unescape('_testDNU'),
|
1371
|
+
smalltalk.method({
|
1372
|
+
selector: unescape('testDNU'),
|
1373
|
+
category: 'tests',
|
1374
|
+
fn: function (){
|
1375
|
+
var self=this;
|
1376
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
|
1377
|
+
return self;},
|
1378
|
+
args: [],
|
1379
|
+
source: unescape('testDNU%0A%09self%20should%3A%20%5BObject%20new%20foo%5D%20raise%3A%20MessageNotUnderstood'),
|
1380
|
+
messageSends: ["should:raise:", "foo", "new"],
|
1381
|
+
referencedClasses: ["Object", "MessageNotUnderstood"]
|
1382
|
+
}),
|
1383
|
+
smalltalk.ObjectTest);
|
1384
|
+
|
1385
|
+
|
1386
|
+
|
1387
|
+
smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1388
|
+
smalltalk.addMethod(
|
1389
|
+
unescape('_testEquality'),
|
1390
|
+
smalltalk.method({
|
1391
|
+
selector: unescape('testEquality'),
|
1392
|
+
category: 'tests',
|
1393
|
+
fn: function (){
|
1394
|
+
var self=this;
|
1395
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
|
1396
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
|
1397
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
|
1398
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
|
1399
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
|
1400
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
|
1401
|
+
return self;},
|
1402
|
+
args: [],
|
1403
|
+
source: unescape('testEquality%0A%09self%20assert%3A%20%23hello%20%3D%20%23hello.%0A%09self%20deny%3A%20%23hello%20%3D%20%23world.%0A%0A%09self%20assert%3A%20%23hello%20%20%3D%20%23hello%20yourself.%0A%09self%20assert%3A%20%23hello%20yourself%20%3D%20%23hello.%0A%0A%09self%20deny%3A%20%23hello%20%20%3D%20%27hello%27.%0A%09self%20deny%3A%20%27hello%27%20%3D%20%23hello.'),
|
1404
|
+
messageSends: ["assert:", unescape("%3D"), "deny:", "yourself"],
|
1405
|
+
referencedClasses: []
|
1406
|
+
}),
|
1407
|
+
smalltalk.SymbolTest);
|
1408
|
+
|
1409
|
+
smalltalk.addMethod(
|
1410
|
+
unescape('_testAt'),
|
1411
|
+
smalltalk.method({
|
1412
|
+
selector: unescape('testAt'),
|
1413
|
+
category: 'tests',
|
1414
|
+
fn: function (){
|
1415
|
+
var self=this;
|
1416
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
|
1417
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
|
1418
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
|
1419
|
+
return self;},
|
1420
|
+
args: [],
|
1421
|
+
source: unescape('testAt%0A%09self%20assert%3A%20%28%23hello%20at%3A%201%29%20%3D%20%27h%27.%0A%09self%20assert%3A%20%28%23hello%20at%3A%205%29%20%3D%20%27o%27.%0A%09self%20assert%3A%20%28%23hello%20at%3A%206%20ifAbsent%3A%20%5Bnil%5D%29%20%3D%20nil'),
|
1422
|
+
messageSends: ["assert:", unescape("%3D"), "at:", "at:ifAbsent:"],
|
1423
|
+
referencedClasses: []
|
1424
|
+
}),
|
1425
|
+
smalltalk.SymbolTest);
|
1426
|
+
|
1427
|
+
smalltalk.addMethod(
|
1428
|
+
unescape('_testAtPut'),
|
1429
|
+
smalltalk.method({
|
1430
|
+
selector: unescape('testAtPut'),
|
1431
|
+
category: 'tests',
|
1432
|
+
fn: function (){
|
1433
|
+
var self=this;
|
1434
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
|
1435
|
+
return self;},
|
1436
|
+
args: [],
|
1437
|
+
source: unescape('testAtPut%0A%09%22Symbol%20instances%20are%20read-only%22%0A%09self%20should%3A%20%5B%27hello%27%20at%3A%201%20put%3A%20%27a%27%5D%20raise%3A%20Error'),
|
1438
|
+
messageSends: ["should:raise:", "at:put:"],
|
1439
|
+
referencedClasses: ["Error"]
|
1440
|
+
}),
|
1441
|
+
smalltalk.SymbolTest);
|
1442
|
+
|
1443
|
+
smalltalk.addMethod(
|
1444
|
+
unescape('_testIdentity'),
|
1445
|
+
smalltalk.method({
|
1446
|
+
selector: unescape('testIdentity'),
|
1447
|
+
category: 'tests',
|
1448
|
+
fn: function (){
|
1449
|
+
var self=this;
|
1450
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
|
1451
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
|
1452
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
|
1453
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
|
1454
|
+
return self;},
|
1455
|
+
args: [],
|
1456
|
+
source: unescape('testIdentity%0A%09self%20assert%3A%20%23hello%20%3D%3D%20%23hello.%0A%09self%20deny%3A%20%23hello%20%3D%3D%20%23world.%0A%0A%09self%20assert%3A%20%23hello%20%20%3D%20%23hello%20yourself.%0A%09self%20assert%3A%20%23hello%20yourself%20%3D%20%23hello%20asString%20asSymbol'),
|
1457
|
+
messageSends: ["assert:", unescape("%3D%3D"), "deny:", unescape("%3D"), "yourself", "asSymbol", "asString"],
|
1458
|
+
referencedClasses: []
|
1459
|
+
}),
|
1460
|
+
smalltalk.SymbolTest);
|
1461
|
+
|
1462
|
+
smalltalk.addMethod(
|
1463
|
+
unescape('_testComparing'),
|
1464
|
+
smalltalk.method({
|
1465
|
+
selector: unescape('testComparing'),
|
1466
|
+
category: 'tests',
|
1467
|
+
fn: function (){
|
1468
|
+
var self=this;
|
1469
|
+
smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
|
1470
|
+
smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
|
1471
|
+
smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
|
1472
|
+
smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
|
1473
|
+
smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
|
1474
|
+
smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
|
1475
|
+
smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
|
1476
|
+
smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
|
1477
|
+
return self;},
|
1478
|
+
args: [],
|
1479
|
+
source: unescape('testComparing%0A%09self%20assert%3A%20%23ab%20%3E%20%23aa.%0A%09self%20deny%3A%20%23ab%20%3E%20%23ba.%0A%0A%09self%20assert%3A%20%23ab%20%3C%20%23ba.%0A%09self%20deny%3A%20%23bb%20%3C%20%23ba.%0A%0A%09self%20assert%3A%20%23ab%20%3E%3D%20%23aa.%0A%09self%20deny%3A%20%23ab%20%3E%3D%20%23ba.%0A%0A%09self%20assert%3A%20%23ab%20%3C%3D%20%23ba.%0A%09self%20deny%3A%20%23bb%20%3C%3D%20%23ba'),
|
1480
|
+
messageSends: ["assert:", unescape("%3E"), "deny:", unescape("%3C"), unescape("%3E%3D"), unescape("%3C%3D")],
|
1481
|
+
referencedClasses: []
|
1482
|
+
}),
|
1483
|
+
smalltalk.SymbolTest);
|
1484
|
+
|
1485
|
+
smalltalk.addMethod(
|
1486
|
+
unescape('_testSize'),
|
1487
|
+
smalltalk.method({
|
1488
|
+
selector: unescape('testSize'),
|
1489
|
+
category: 'tests',
|
1490
|
+
fn: function (){
|
1491
|
+
var self=this;
|
1492
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
|
1493
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
|
1494
|
+
return self;},
|
1495
|
+
args: [],
|
1496
|
+
source: unescape('testSize%0A%09self%20assert%3A%20%23a%20size%20equals%3A%201.%0A%09self%20assert%3A%20%23aaaaa%20size%20equals%3A%205'),
|
1497
|
+
messageSends: ["assert:equals:", "size"],
|
1498
|
+
referencedClasses: []
|
1499
|
+
}),
|
1500
|
+
smalltalk.SymbolTest);
|
1501
|
+
|
1502
|
+
smalltalk.addMethod(
|
1503
|
+
unescape('_testAsString'),
|
1504
|
+
smalltalk.method({
|
1505
|
+
selector: unescape('testAsString'),
|
1506
|
+
category: 'tests',
|
1507
|
+
fn: function (){
|
1508
|
+
var self=this;
|
1509
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
|
1510
|
+
return self;},
|
1511
|
+
args: [],
|
1512
|
+
source: unescape('testAsString%0A%09self%20assert%3A%20%23hello%20asString%20equals%3A%20%27hello%27'),
|
1513
|
+
messageSends: ["assert:equals:", "asString"],
|
1514
|
+
referencedClasses: []
|
1515
|
+
}),
|
1516
|
+
smalltalk.SymbolTest);
|
1517
|
+
|
1518
|
+
smalltalk.addMethod(
|
1519
|
+
unescape('_testAsSymbol'),
|
1520
|
+
smalltalk.method({
|
1521
|
+
selector: unescape('testAsSymbol'),
|
1522
|
+
category: 'tests',
|
1523
|
+
fn: function (){
|
1524
|
+
var self=this;
|
1525
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
|
1526
|
+
return self;},
|
1527
|
+
args: [],
|
1528
|
+
source: unescape('testAsSymbol%0A%09self%20assert%3A%20%23hello%20%3D%3D%20%23hello%20asSymbol'),
|
1529
|
+
messageSends: ["assert:", unescape("%3D%3D"), "asSymbol"],
|
1530
|
+
referencedClasses: []
|
1531
|
+
}),
|
1532
|
+
smalltalk.SymbolTest);
|
1533
|
+
|
1534
|
+
smalltalk.addMethod(
|
1535
|
+
unescape('_testCopying'),
|
1536
|
+
smalltalk.method({
|
1537
|
+
selector: unescape('testCopying'),
|
1538
|
+
category: 'tests',
|
1539
|
+
fn: function (){
|
1540
|
+
var self=this;
|
1541
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
|
1542
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
|
1543
|
+
return self;},
|
1544
|
+
args: [],
|
1545
|
+
source: unescape('testCopying%0A%09self%20assert%3A%20%23hello%20copy%20%3D%3D%20%23hello.%0A%09self%20assert%3A%20%23hello%20deepCopy%20%3D%3D%20%23hello'),
|
1546
|
+
messageSends: ["assert:", unescape("%3D%3D"), "copy", "deepCopy"],
|
1547
|
+
referencedClasses: []
|
1548
|
+
}),
|
1549
|
+
smalltalk.SymbolTest);
|
1550
|
+
|
1551
|
+
smalltalk.addMethod(
|
1552
|
+
unescape('_testIsSymbolIsString'),
|
1553
|
+
smalltalk.method({
|
1554
|
+
selector: unescape('testIsSymbolIsString'),
|
1555
|
+
category: 'tests',
|
1556
|
+
fn: function (){
|
1557
|
+
var self=this;
|
1558
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
|
1559
|
+
smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
|
1560
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
|
1561
|
+
smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
|
1562
|
+
return self;},
|
1563
|
+
args: [],
|
1564
|
+
source: unescape('testIsSymbolIsString%0A%09self%20assert%3A%20%23hello%20isSymbol.%0A%09self%20deny%3A%20%27hello%27%20isSymbol.%0A%09self%20deny%3A%20%23hello%20isString.%0A%09self%20assert%3A%20%27hello%27%20isString'),
|
1565
|
+
messageSends: ["assert:", "isSymbol", "deny:", "isString"],
|
1566
|
+
referencedClasses: []
|
1567
|
+
}),
|
1568
|
+
smalltalk.SymbolTest);
|
1569
|
+
|
1570
|
+
|
1571
|
+
|
1572
|
+
smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
|
1573
|
+
smalltalk.addMethod(
|
1574
|
+
unescape('_foo'),
|
1575
|
+
smalltalk.method({
|
1576
|
+
selector: unescape('foo'),
|
1577
|
+
category: 'not yet classified',
|
1578
|
+
fn: function (){
|
1579
|
+
var self=this;
|
1580
|
+
return self['@foo'];
|
1581
|
+
return self;},
|
1582
|
+
args: [],
|
1583
|
+
source: unescape('foo%0A%09%5Efoo'),
|
1584
|
+
messageSends: [],
|
1585
|
+
referencedClasses: []
|
1586
|
+
}),
|
1587
|
+
smalltalk.ObjectMock);
|
1588
|
+
|
1589
|
+
smalltalk.addMethod(
|
1590
|
+
unescape('_foo_'),
|
1591
|
+
smalltalk.method({
|
1592
|
+
selector: unescape('foo%3A'),
|
1593
|
+
category: 'not yet classified',
|
1594
|
+
fn: function (anObject){
|
1595
|
+
var self=this;
|
1596
|
+
(self['@foo']=anObject);
|
1597
|
+
return self;},
|
1598
|
+
args: ["anObject"],
|
1599
|
+
source: unescape('foo%3A%20anObject%0A%09foo%20%3A%3D%20anObject'),
|
1600
|
+
messageSends: [],
|
1601
|
+
referencedClasses: []
|
1602
|
+
}),
|
1603
|
+
smalltalk.ObjectMock);
|
1604
|
+
|
1605
|
+
|
1606
|
+
|
1607
|
+
smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1608
|
+
smalltalk.addMethod(
|
1609
|
+
unescape('_testIsNil'),
|
1610
|
+
smalltalk.method({
|
1611
|
+
selector: unescape('testIsNil'),
|
1612
|
+
category: 'tests',
|
1613
|
+
fn: function (){
|
1614
|
+
var self=this;
|
1615
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
|
1616
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
|
1617
|
+
return self;},
|
1618
|
+
args: [],
|
1619
|
+
source: unescape('testIsNil%0A%09self%20assert%3A%20nil%20isNil.%0A%09self%20deny%3A%20nil%20notNil.'),
|
1620
|
+
messageSends: ["assert:", "isNil", "deny:", "notNil"],
|
1621
|
+
referencedClasses: []
|
1622
|
+
}),
|
1623
|
+
smalltalk.UndefinedTest);
|
1624
|
+
|
1625
|
+
smalltalk.addMethod(
|
1626
|
+
unescape('_testIfNil'),
|
1627
|
+
smalltalk.method({
|
1628
|
+
selector: unescape('testIfNil'),
|
1629
|
+
category: 'tests',
|
1630
|
+
fn: function (){
|
1631
|
+
var self=this;
|
1632
|
+
smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
|
1633
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
|
1634
|
+
smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
|
1635
|
+
smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
|
1636
|
+
return self;},
|
1637
|
+
args: [],
|
1638
|
+
source: unescape('testIfNil%0A%09self%20assert%3A%20%28nil%20ifNil%3A%20%5Btrue%5D%29%20equals%3A%20true.%0A%09self%20deny%3A%20%28nil%20ifNotNil%3A%20%5Btrue%5D%29%20%3D%20true.%0A%09self%20assert%3A%20%28nil%20ifNil%3A%20%5Btrue%5D%20ifNotNil%3A%20%5Bfalse%5D%29%20equals%3A%20true.%0A%09self%20deny%3A%20%28nil%20ifNotNil%3A%20%5Btrue%5D%20ifNil%3A%20%5Bfalse%5D%29%20%3D%20true'),
|
1639
|
+
messageSends: ["assert:equals:", "ifNil:", "deny:", unescape("%3D"), "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
|
1640
|
+
referencedClasses: []
|
1641
|
+
}),
|
1642
|
+
smalltalk.UndefinedTest);
|
1643
|
+
|
1644
|
+
smalltalk.addMethod(
|
1645
|
+
unescape('_testCopying'),
|
1646
|
+
smalltalk.method({
|
1647
|
+
selector: unescape('testCopying'),
|
1648
|
+
category: 'tests',
|
1649
|
+
fn: function (){
|
1650
|
+
var self=this;
|
1651
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
|
1652
|
+
return self;},
|
1653
|
+
args: [],
|
1654
|
+
source: unescape('testCopying%0A%09self%20assert%3A%20nil%20copy%20equals%3A%20nil'),
|
1655
|
+
messageSends: ["assert:equals:", "copy"],
|
1656
|
+
referencedClasses: []
|
1657
|
+
}),
|
1658
|
+
smalltalk.UndefinedTest);
|
1659
|
+
|
1660
|
+
smalltalk.addMethod(
|
1661
|
+
unescape('_testDeepCopy'),
|
1662
|
+
smalltalk.method({
|
1663
|
+
selector: unescape('testDeepCopy'),
|
1664
|
+
category: 'tests',
|
1665
|
+
fn: function (){
|
1666
|
+
var self=this;
|
1667
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
|
1668
|
+
return self;},
|
1669
|
+
args: [],
|
1670
|
+
source: unescape('testDeepCopy%0A%09self%20assert%3A%20nil%20deepCopy%20%3D%20nil'),
|
1671
|
+
messageSends: ["assert:", unescape("%3D"), "deepCopy"],
|
1672
|
+
referencedClasses: []
|
1673
|
+
}),
|
1674
|
+
smalltalk.UndefinedTest);
|
1675
|
+
|
1676
|
+
|
1677
|
+
|
1678
|
+
smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1679
|
+
smalltalk.addMethod(
|
1680
|
+
unescape('_testAccessing'),
|
1681
|
+
smalltalk.method({
|
1682
|
+
selector: unescape('testAccessing'),
|
1683
|
+
category: 'tests',
|
1684
|
+
fn: function (){
|
1685
|
+
var self=this;
|
1686
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
|
1687
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
|
1688
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
|
1689
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
|
1690
|
+
return self;},
|
1691
|
+
args: [],
|
1692
|
+
source: unescape('testAccessing%0A%09self%20assert%3A%20%28Point%20x%3A%203%20y%3A%204%29%20x%20equals%3A%203.%0A%09self%20assert%3A%20%28Point%20x%3A%203%20y%3A%204%29%20y%20equals%3A%204.%0A%09self%20assert%3A%20%28Point%20new%20x%3A%203%29%20x%20equals%3A%203.%0A%09self%20assert%3A%20%28Point%20new%20y%3A%204%29%20y%20equals%3A%204'),
|
1693
|
+
messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
|
1694
|
+
referencedClasses: ["Point"]
|
1695
|
+
}),
|
1696
|
+
smalltalk.PointTest);
|
1697
|
+
|
1698
|
+
smalltalk.addMethod(
|
1699
|
+
unescape('_testAt'),
|
1700
|
+
smalltalk.method({
|
1701
|
+
selector: unescape('testAt'),
|
1702
|
+
category: 'tests',
|
1703
|
+
fn: function (){
|
1704
|
+
var self=this;
|
1705
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
|
1706
|
+
return self;},
|
1707
|
+
args: [],
|
1708
|
+
source: unescape('testAt%0A%09self%20assert%3A%203@4%20equals%3A%20%28Point%20x%3A%203%20y%3A%204%29'),
|
1709
|
+
messageSends: ["assert:equals:", unescape("@"), "x:y:"],
|
1710
|
+
referencedClasses: ["Point"]
|
1711
|
+
}),
|
1712
|
+
smalltalk.PointTest);
|
1713
|
+
|
1714
|
+
smalltalk.addMethod(
|
1715
|
+
unescape('_testEgality'),
|
1716
|
+
smalltalk.method({
|
1717
|
+
selector: unescape('testEgality'),
|
1718
|
+
category: 'tests',
|
1719
|
+
fn: function (){
|
1720
|
+
var self=this;
|
1721
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
|
1722
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
|
1723
|
+
return self;},
|
1724
|
+
args: [],
|
1725
|
+
source: unescape('testEgality%0A%09self%20assert%3A%203@4%20%3D%20%283@4%29.%0A%09self%20deny%3A%203@5%20%3D%20%283@6%29'),
|
1726
|
+
messageSends: ["assert:", unescape("%3D"), unescape("@"), "deny:"],
|
1727
|
+
referencedClasses: []
|
1728
|
+
}),
|
1729
|
+
smalltalk.PointTest);
|
1730
|
+
|
1731
|
+
smalltalk.addMethod(
|
1732
|
+
unescape('_testArithmetic'),
|
1733
|
+
smalltalk.method({
|
1734
|
+
selector: unescape('testArithmetic'),
|
1735
|
+
category: 'tests',
|
1736
|
+
fn: function (){
|
1737
|
+
var self=this;
|
1738
|
+
smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
|
1739
|
+
smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
|
1740
|
+
smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
|
1741
|
+
smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
|
1742
|
+
return self;},
|
1743
|
+
args: [],
|
1744
|
+
source: unescape('testArithmetic%0A%09self%20assert%3A%203@4%20*%20%283@4%20%29%20equals%3A%20%28Point%20x%3A%209%20y%3A%2016%29.%0A%09self%20assert%3A%203@4%20+%20%283@4%20%29%20equals%3A%20%28Point%20x%3A%206%20y%3A%208%29.%0A%09self%20assert%3A%203@4%20-%20%283@4%20%29%20equals%3A%20%28Point%20x%3A%200%20y%3A%200%29.%0A%09self%20assert%3A%206@8%20/%20%283@4%20%29%20equals%3A%20%28Point%20x%3A%202%20y%3A%202%29'),
|
1745
|
+
messageSends: ["assert:equals:", unescape("*"), unescape("@"), "x:y:", unescape("+"), unescape("-"), unescape("/")],
|
1746
|
+
referencedClasses: ["Point"]
|
1747
|
+
}),
|
1748
|
+
smalltalk.PointTest);
|
1749
|
+
|
1750
|
+
|
1751
|
+
|
1752
|
+
smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1753
|
+
smalltalk.addMethod(
|
1754
|
+
unescape('_textNext'),
|
1755
|
+
smalltalk.method({
|
1756
|
+
selector: unescape('textNext'),
|
1757
|
+
category: 'tests',
|
1758
|
+
fn: function (){
|
1759
|
+
var self=this;
|
1760
|
+
smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
|
1761
|
+
var next=nil;
|
1762
|
+
(next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []));smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
|
1763
|
+
return self;},
|
1764
|
+
args: [],
|
1765
|
+
source: unescape('textNext%0A%0A%0910000%20timesRepeat%3A%20%5B%0A%09%09%09%7C%20current%20next%20%7C%20%0A%09%09%09next%20%3A%3D%20Random%20new%20next.%0A%09%09%09self%20assert%3A%20%28next%20%3E%3D%200%29.%0A%09%09%09self%20assert%3A%20%28next%20%3C%201%29.%0A%09%09%09self%20deny%3A%20current%20%3D%20next.%0A%09%09%09next%20%3D%20current%5D'),
|
1766
|
+
messageSends: ["timesRepeat:", "next", "new", "assert:", unescape("%3E%3D"), unescape("%3C"), "deny:", unescape("%3D")],
|
1767
|
+
referencedClasses: ["Random"]
|
1768
|
+
}),
|
1769
|
+
smalltalk.RandomTest);
|
1770
|
+
|
1771
|
+
|
1772
|
+
|
1773
|
+
smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
|
1774
|
+
smalltalk.addMethod(
|
1775
|
+
unescape('_setUp'),
|
1776
|
+
smalltalk.method({
|
1777
|
+
selector: unescape('setUp'),
|
1778
|
+
category: 'running',
|
1779
|
+
fn: function (){
|
1780
|
+
var self=this;
|
1781
|
+
(self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
|
1782
|
+
return self;},
|
1783
|
+
args: [],
|
1784
|
+
source: unescape('setUp%0A%09builder%20%3A%3D%20ClassBuilder%20new'),
|
1785
|
+
messageSends: ["new"],
|
1786
|
+
referencedClasses: ["ClassBuilder"]
|
1787
|
+
}),
|
1788
|
+
smalltalk.ClassBuilderTest);
|
1789
|
+
|
1790
|
+
smalltalk.addMethod(
|
1791
|
+
unescape('_tearDown'),
|
1792
|
+
smalltalk.method({
|
1793
|
+
selector: unescape('tearDown'),
|
1794
|
+
category: 'running',
|
1795
|
+
fn: function (){
|
1796
|
+
var self=this;
|
1797
|
+
(($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
|
1798
|
+
return self;},
|
1799
|
+
args: [],
|
1800
|
+
source: unescape('tearDown%0A%09theClass%20ifNotNil%3A%20%5BSmalltalk%20current%20removeClass%3A%20theClass.%20theClass%20%3A%3D%20nil%5D'),
|
1801
|
+
messageSends: ["ifNotNil:", "removeClass:", "current"],
|
1802
|
+
referencedClasses: ["Smalltalk"]
|
1803
|
+
}),
|
1804
|
+
smalltalk.ClassBuilderTest);
|
1805
|
+
|
1806
|
+
smalltalk.addMethod(
|
1807
|
+
unescape('_testClassCopy'),
|
1808
|
+
smalltalk.method({
|
1809
|
+
selector: unescape('testClassCopy'),
|
1810
|
+
category: 'running',
|
1811
|
+
fn: function (){
|
1812
|
+
var self=this;
|
1813
|
+
(self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
|
1814
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
|
1815
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
|
1816
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
|
1817
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
|
1818
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
|
1819
|
+
return self;},
|
1820
|
+
args: [],
|
1821
|
+
source: unescape('testClassCopy%0A%09theClass%20%3A%3D%20builder%20copyClass%3A%20ObjectMock%20named%3A%20%27ObjectMock2%27.%0A%09self%20assert%3A%20theClass%20superclass%20%3D%3D%20ObjectMock%20superclass.%0A%09self%20assert%3A%20theClass%20instanceVariableNames%20%3D%3D%20ObjectMock%20instanceVariableNames.%0A%09self%20assert%3A%20theClass%20name%20equals%3A%20%27ObjectMock2%27.%0A%09self%20assert%3A%20theClass%20package%20%3D%3D%20ObjectMock%20package.%0A%09self%20assert%3A%20theClass%20methodDictionary%20keys%20equals%3A%20ObjectMock%20methodDictionary%20keys'),
|
1822
|
+
messageSends: ["copyClass:named:", "assert:", unescape("%3D%3D"), "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
|
1823
|
+
referencedClasses: ["ObjectMock"]
|
1824
|
+
}),
|
1825
|
+
smalltalk.ClassBuilderTest);
|
1826
|
+
|
1827
|
+
smalltalk.addMethod(
|
1828
|
+
unescape('_testInstanceVariableNames'),
|
1829
|
+
smalltalk.method({
|
1830
|
+
selector: unescape('testInstanceVariableNames'),
|
1831
|
+
category: 'running',
|
1832
|
+
fn: function (){
|
1833
|
+
var self=this;
|
1834
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
|
1835
|
+
return self;},
|
1836
|
+
args: [],
|
1837
|
+
source: unescape('testInstanceVariableNames%0A%09self%20assert%3A%20%28builder%20instanceVariableNamesFor%3A%20%27%20%20hello%20%20%20world%20%20%20%27%29%20equals%3A%20%23%28%27hello%27%20%27world%27%29'),
|
1838
|
+
messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
|
1839
|
+
referencedClasses: []
|
1840
|
+
}),
|
1841
|
+
smalltalk.ClassBuilderTest);
|
1842
|
+
|
1843
|
+
|
1844
|
+
|
1845
|
+
smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
1846
|
+
smalltalk.addMethod(
|
1847
|
+
unescape('_testUnicity'),
|
1848
|
+
smalltalk.method({
|
1849
|
+
selector: unescape('testUnicity'),
|
1850
|
+
category: 'tests',
|
1851
|
+
fn: function (){
|
1852
|
+
var self=this;
|
1853
|
+
var set=nil;
|
1854
|
+
(set=smalltalk.send((smalltalk.Set || Set), "_new", []));
|
1855
|
+
smalltalk.send(set, "_add_", [(21)]);
|
1856
|
+
smalltalk.send(set, "_add_", ["hello"]);
|
1857
|
+
smalltalk.send(set, "_add_", [(21)]);
|
1858
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
|
1859
|
+
smalltalk.send(set, "_add_", ["hello"]);
|
1860
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
|
1861
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
|
1862
|
+
return self;},
|
1863
|
+
args: [],
|
1864
|
+
source: unescape('testUnicity%0A%09%7C%20set%20%7C%0A%09set%20%3A%3D%20Set%20new.%0A%09set%20add%3A%2021.%0A%09set%20add%3A%20%27hello%27.%0A%0A%09set%20add%3A%2021.%0A%09self%20assert%3A%20set%20size%20%3D%202.%0A%09%0A%09set%20add%3A%20%27hello%27.%0A%09self%20assert%3A%20set%20size%20%3D%202.%0A%0A%09self%20assert%3A%20set%20asArray%20equals%3A%20%23%2821%20%27hello%27%29'),
|
1865
|
+
messageSends: ["new", "add:", "assert:", unescape("%3D"), "size", "assert:equals:", "asArray"],
|
1866
|
+
referencedClasses: ["Set"]
|
1867
|
+
}),
|
1868
|
+
smalltalk.SetTest);
|
1869
|
+
|
1870
|
+
smalltalk.addMethod(
|
1871
|
+
unescape('_testAt'),
|
1872
|
+
smalltalk.method({
|
1873
|
+
selector: unescape('testAt'),
|
1874
|
+
category: 'tests',
|
1875
|
+
fn: function (){
|
1876
|
+
var self=this;
|
1877
|
+
smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
|
1878
|
+
return self;},
|
1879
|
+
args: [],
|
1880
|
+
source: unescape('testAt%0A%09self%20should%3A%20%5BSet%20new%20at%3A%201%20put%3A%202%5D%20raise%3A%20Error'),
|
1881
|
+
messageSends: ["should:raise:", "at:put:", "new"],
|
1882
|
+
referencedClasses: ["Set", "Error"]
|
1883
|
+
}),
|
1884
|
+
smalltalk.SetTest);
|
1885
|
+
|
1886
|
+
smalltalk.addMethod(
|
1887
|
+
unescape('_testAddRemove'),
|
1888
|
+
smalltalk.method({
|
1889
|
+
selector: unescape('testAddRemove'),
|
1890
|
+
category: 'tests',
|
1891
|
+
fn: function (){
|
1892
|
+
var self=this;
|
1893
|
+
var set=nil;
|
1894
|
+
(set=smalltalk.send((smalltalk.Set || Set), "_new", []));
|
1895
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
|
1896
|
+
smalltalk.send(set, "_add_", [(3)]);
|
1897
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
|
1898
|
+
smalltalk.send(set, "_add_", [(5)]);
|
1899
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
|
1900
|
+
smalltalk.send(set, "_remove_", [(3)]);
|
1901
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
|
1902
|
+
return self;},
|
1903
|
+
args: [],
|
1904
|
+
source: unescape('testAddRemove%0A%09%7C%20set%20%7C%0A%09set%20%3A%3D%20Set%20new.%0A%09%0A%09self%20assert%3A%20set%20isEmpty.%0A%0A%09set%20add%3A%203.%0A%09self%20assert%3A%20%28set%20includes%3A%203%29.%0A%0A%09set%20add%3A%205.%0A%09self%20assert%3A%20%28set%20includes%3A%205%29.%0A%0A%09set%20remove%3A%203.%0A%09self%20deny%3A%20%28set%20includes%3A%203%29'),
|
1905
|
+
messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
|
1906
|
+
referencedClasses: ["Set"]
|
1907
|
+
}),
|
1908
|
+
smalltalk.SetTest);
|
1909
|
+
|
1910
|
+
smalltalk.addMethod(
|
1911
|
+
unescape('_testSize'),
|
1912
|
+
smalltalk.method({
|
1913
|
+
selector: unescape('testSize'),
|
1914
|
+
category: 'tests',
|
1915
|
+
fn: function (){
|
1916
|
+
var self=this;
|
1917
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
|
1918
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
|
1919
|
+
smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
|
1920
|
+
return self;},
|
1921
|
+
args: [],
|
1922
|
+
source: unescape('testSize%0A%09self%20assert%3A%20Set%20new%20size%20equals%3A%200.%0A%09self%20assert%3A%20%28Set%20withAll%3A%20%23%281%202%203%204%29%29%20size%20equals%3A%204.%0A%09self%20assert%3A%20%28Set%20withAll%3A%20%23%281%201%201%201%29%29%20size%20equals%3A%201'),
|
1923
|
+
messageSends: ["assert:equals:", "size", "new", "withAll:"],
|
1924
|
+
referencedClasses: ["Set"]
|
1925
|
+
}),
|
1926
|
+
smalltalk.SetTest);
|
1927
|
+
|
1928
|
+
|
1929
|
+
|