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