resin 0.2.2 → 0.2.3
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/amber/css/amber-normalize.css +73 -73
- data/amber/css/amber-normalize.less +1 -1
- data/amber/css/amber.css +106 -106
- data/amber/css/helios.css +242 -0
- data/amber/images/hsplitter.png +0 -0
- data/amber/images/vsplitter.png +0 -0
- data/amber/js/Benchfib.deploy.js +116 -38
- data/amber/js/Benchfib.js +120 -42
- data/amber/js/Canvas.deploy.js +674 -403
- data/amber/js/Canvas.js +682 -411
- data/amber/js/Compiler-AST.deploy.js +1150 -0
- data/amber/js/Compiler-AST.js +1591 -0
- data/amber/js/Compiler-Core.deploy.js +1562 -0
- data/amber/js/Compiler-Core.js +1972 -0
- data/amber/js/Compiler-Exceptions.deploy.js +114 -0
- data/amber/js/Compiler-Exceptions.js +161 -0
- data/amber/js/Compiler-IR.deploy.js +2326 -0
- data/amber/js/Compiler-IR.js +3146 -0
- data/amber/js/Compiler-Inlining.deploy.js +1147 -0
- data/amber/js/Compiler-Inlining.js +1514 -0
- data/amber/js/Compiler-Semantic.deploy.js +1207 -0
- data/amber/js/Compiler-Semantic.js +1628 -0
- data/amber/js/Compiler-Tests.deploy.js +646 -60
- data/amber/js/Compiler-Tests.js +843 -82
- data/amber/js/Compiler.deploy.js +1097 -159
- data/amber/js/Compiler.js +1414 -161
- data/amber/js/Examples.deploy.js +31 -15
- data/amber/js/Examples.js +33 -17
- data/amber/js/Helios-Announcements.deploy.js +127 -0
- data/amber/js/Helios-Announcements.js +157 -0
- data/amber/js/Helios-Browser.deploy.js +1473 -0
- data/amber/js/Helios-Browser.js +1953 -0
- data/amber/js/Helios-Commands.deploy.js +403 -0
- data/amber/js/Helios-Commands.js +563 -0
- data/amber/js/Helios-Core.deploy.js +1070 -0
- data/amber/js/Helios-Core.js +1445 -0
- data/amber/js/Helios-Environments.deploy.js +132 -0
- data/amber/js/Helios-Environments.js +179 -0
- data/amber/js/Helios-Inspector.deploy.js +855 -0
- data/amber/js/Helios-Inspector.js +1155 -0
- data/amber/js/Helios-KeyBindings.deploy.js +753 -0
- data/amber/js/Helios-KeyBindings.js +1023 -0
- data/amber/js/Helios-Layout.deploy.js +383 -0
- data/amber/js/Helios-Layout.js +523 -0
- data/amber/js/Helios-Workspace.deploy.js +799 -0
- data/amber/js/Helios-Workspace.js +1074 -0
- data/amber/js/IDE.deploy.js +2541 -1490
- data/amber/js/IDE.js +2721 -1660
- data/amber/js/Importer-Exporter.deploy.js +671 -0
- data/amber/js/Importer-Exporter.js +816 -0
- data/amber/js/Kernel-Announcements.deploy.js +137 -20
- data/amber/js/Kernel-Announcements.js +176 -22
- data/amber/js/Kernel-Classes.deploy.js +555 -168
- data/amber/js/Kernel-Classes.js +662 -205
- data/amber/js/Kernel-Collections.deploy.js +1403 -618
- data/amber/js/Kernel-Collections.js +1545 -690
- data/amber/js/Kernel-Exceptions.deploy.js +109 -45
- data/amber/js/Kernel-Exceptions.js +123 -49
- data/amber/js/Kernel-Methods.deploy.js +196 -81
- data/amber/js/Kernel-Methods.js +214 -89
- data/amber/js/Kernel-Objects.deploy.js +1542 -1117
- data/amber/js/Kernel-Objects.js +1593 -1148
- data/amber/js/Kernel-Tests.deploy.js +1725 -772
- data/amber/js/Kernel-Tests.js +2301 -1123
- data/amber/js/Kernel-Transcript.deploy.js +23 -25
- data/amber/js/Kernel-Transcript.js +24 -26
- data/amber/js/SUnit.deploy.js +204 -131
- data/amber/js/SUnit.js +222 -139
- data/amber/js/Spaces.deploy.js +240 -0
- data/amber/js/Spaces.js +326 -0
- data/amber/js/amber.js +26 -7
- data/amber/js/boot.js +65 -47
- data/amber/js/init.js +1 -1
- data/amber/js/lib/CodeMirror/amber.css +21 -21
- data/amber/js/lib/CodeMirror/codemirror.css +119 -13
- data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
- data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
- data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
- data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
- data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
- data/amber/st/Compiler-AST.st +505 -0
- data/amber/st/Compiler-Core.st +835 -0
- data/amber/st/Compiler-Exceptions.st +87 -0
- data/amber/st/Compiler-IR.st +1097 -0
- data/amber/st/Compiler-Inlining.st +650 -0
- data/amber/st/Compiler-Semantic.st +558 -0
- data/amber/st/Compiler-Tests.st +285 -381
- data/amber/st/Compiler.st +725 -2
- data/amber/st/Helios-Announcements.st +104 -0
- data/amber/st/Helios-Browser.st +708 -0
- data/amber/st/Helios-Commands.st +223 -0
- data/amber/st/Helios-Core.st +532 -0
- data/amber/st/Helios-Environments.st +98 -0
- data/amber/st/Helios-Inspector.st +367 -0
- data/amber/st/Helios-KeyBindings.st +337 -0
- data/amber/st/Helios-Layout.st +199 -0
- data/amber/st/Helios-Workspace.st +367 -0
- data/amber/st/IDE.st +75 -53
- data/amber/st/Importer-Exporter.st +386 -0
- data/amber/st/Kernel-Announcements.st +92 -0
- data/amber/st/Kernel-Classes.st +137 -15
- data/amber/st/Kernel-Collections.st +137 -47
- data/amber/st/Kernel-Exceptions.st +14 -0
- data/amber/st/Kernel-Methods.st +9 -1
- data/amber/st/Kernel-Objects.st +29 -5
- data/amber/st/Kernel-Tests.st +545 -199
- data/amber/st/SUnit.st +10 -0
- data/amber/st/Spaces.st +142 -0
- data/lib/resin/app.rb +1 -1
- metadata +86 -31
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
data/amber/js/Kernel-Tests.js
CHANGED
|
@@ -1,62 +1,4 @@
|
|
|
1
1
|
smalltalk.addPackage('Kernel-Tests', {});
|
|
2
|
-
smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
3
|
-
smalltalk.addMethod(
|
|
4
|
-
"_testAtIfAbsent",
|
|
5
|
-
smalltalk.method({
|
|
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",
|
|
30
|
-
category: 'testing',
|
|
31
|
-
fn: function (){
|
|
32
|
-
var self=this;
|
|
33
|
-
smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
|
|
34
|
-
return self;},
|
|
35
|
-
args: [],
|
|
36
|
-
source: "testFirstN\x0a\x09self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).",
|
|
37
|
-
messageSends: ["assert:equals:", "first:"],
|
|
38
|
-
referencedClasses: []
|
|
39
|
-
}),
|
|
40
|
-
smalltalk.ArrayTest);
|
|
41
|
-
|
|
42
|
-
smalltalk.addMethod(
|
|
43
|
-
"_testIfEmpty",
|
|
44
|
-
smalltalk.method({
|
|
45
|
-
selector: "testIfEmpty",
|
|
46
|
-
category: 'testing',
|
|
47
|
-
fn: function (){
|
|
48
|
-
var self=this;
|
|
49
|
-
smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
|
|
50
|
-
return self;},
|
|
51
|
-
args: [],
|
|
52
|
-
source: "testIfEmpty\x0a\x09self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )",
|
|
53
|
-
messageSends: ["assert:equals:", "ifEmpty:"],
|
|
54
|
-
referencedClasses: []
|
|
55
|
-
}),
|
|
56
|
-
smalltalk.ArrayTest);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
2
|
smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
61
3
|
smalltalk.addMethod(
|
|
62
4
|
"_testCompiledSource",
|
|
@@ -65,8 +7,10 @@ selector: "testCompiledSource",
|
|
|
65
7
|
category: 'tests',
|
|
66
8
|
fn: function (){
|
|
67
9
|
var self=this;
|
|
68
|
-
smalltalk.send(self,
|
|
69
|
-
return
|
|
10
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((function(){
|
|
11
|
+
return smalltalk.send((1),"__plus",[(1)]);
|
|
12
|
+
}),"_compiledSource",[]),"_includesSubString_",["function"])]);
|
|
13
|
+
return self},
|
|
70
14
|
args: [],
|
|
71
15
|
source: "testCompiledSource\x0a\x09self assert: ([1+1] compiledSource includesSubString: 'function')",
|
|
72
16
|
messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
|
|
@@ -81,8 +25,12 @@ selector: "testEnsure",
|
|
|
81
25
|
category: 'tests',
|
|
82
26
|
fn: function (){
|
|
83
27
|
var self=this;
|
|
84
|
-
smalltalk.send(self,
|
|
85
|
-
return
|
|
28
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((function(){
|
|
29
|
+
return smalltalk.send((smalltalk.Error || Error),"_new",[]);
|
|
30
|
+
}),"_ensure_",[(function(){
|
|
31
|
+
return true;
|
|
32
|
+
})])]);
|
|
33
|
+
return self},
|
|
86
34
|
args: [],
|
|
87
35
|
source: "testEnsure\x0a\x09self assert: ([Error new] ensure: [true])",
|
|
88
36
|
messageSends: ["assert:", "ensure:", "new"],
|
|
@@ -97,9 +45,11 @@ selector: "testNumArgs",
|
|
|
97
45
|
category: 'tests',
|
|
98
46
|
fn: function (){
|
|
99
47
|
var self=this;
|
|
100
|
-
smalltalk.send(self,
|
|
101
|
-
|
|
102
|
-
|
|
48
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
|
|
49
|
+
}),"_numArgs",[]),(0)]);
|
|
50
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
|
|
51
|
+
}),"_numArgs",[]),(2)]);
|
|
52
|
+
return self},
|
|
103
53
|
args: [],
|
|
104
54
|
source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [:a :b | ] numArgs equals: 2",
|
|
105
55
|
messageSends: ["assert:equals:", "numArgs"],
|
|
@@ -114,8 +64,12 @@ selector: "testOnDo",
|
|
|
114
64
|
category: 'tests',
|
|
115
65
|
fn: function (){
|
|
116
66
|
var self=this;
|
|
117
|
-
smalltalk.send(self,
|
|
118
|
-
return
|
|
67
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((function(){
|
|
68
|
+
return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
|
|
69
|
+
}),"_on_do_",[(smalltalk.Error || Error),(function(ex){
|
|
70
|
+
return true;
|
|
71
|
+
})])]);
|
|
72
|
+
return self},
|
|
119
73
|
args: [],
|
|
120
74
|
source: "testOnDo\x0a\x09self assert: ([Error new signal] on: Error do: [:ex | true])",
|
|
121
75
|
messageSends: ["assert:", "on:do:", "signal", "new"],
|
|
@@ -130,11 +84,19 @@ selector: "testValue",
|
|
|
130
84
|
category: 'tests',
|
|
131
85
|
fn: function (){
|
|
132
86
|
var self=this;
|
|
133
|
-
smalltalk.send(self,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
smalltalk.send(self,
|
|
137
|
-
return
|
|
87
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
|
|
88
|
+
return smalltalk.send((1),"__plus",[(1)]);
|
|
89
|
+
}),"_value",[]),(2)]);
|
|
90
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x){
|
|
91
|
+
return smalltalk.send(x,"__plus",[(1)]);
|
|
92
|
+
}),"_value_",[(2)]),(3)]);
|
|
93
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x,y){
|
|
94
|
+
return smalltalk.send(x,"__star",[y]);
|
|
95
|
+
}),"_value_value_",[(2),(4)]),(8)]);
|
|
96
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b,c){
|
|
97
|
+
return (1);
|
|
98
|
+
}),"_value",[]),(1)]);
|
|
99
|
+
return self},
|
|
138
100
|
args: [],
|
|
139
101
|
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
102
|
messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
|
|
@@ -149,10 +111,16 @@ selector: "testValueWithPossibleArguments",
|
|
|
149
111
|
category: 'tests',
|
|
150
112
|
fn: function (){
|
|
151
113
|
var self=this;
|
|
152
|
-
smalltalk.send(self,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
114
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
|
|
115
|
+
return (1);
|
|
116
|
+
}),"_valueWithPossibleArguments_",[[(3), (4)]]),(1)]);
|
|
117
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a){
|
|
118
|
+
return smalltalk.send(a,"__plus",[(4)]);
|
|
119
|
+
}),"_valueWithPossibleArguments_",[[(3), (4)]]),(7)]);
|
|
120
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
|
|
121
|
+
return smalltalk.send(a,"__plus",[b]);
|
|
122
|
+
}),"_valueWithPossibleArguments_",[[(3), (4), (5)]]),(7)]);
|
|
123
|
+
return self},
|
|
156
124
|
args: [],
|
|
157
125
|
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
126
|
messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
|
|
@@ -167,17 +135,26 @@ selector: "testWhileFalse",
|
|
|
167
135
|
category: 'tests',
|
|
168
136
|
fn: function (){
|
|
169
137
|
var self=this;
|
|
170
|
-
var i
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
smalltalk.send(
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
138
|
+
var i;
|
|
139
|
+
i=(0);
|
|
140
|
+
smalltalk.send((function(){
|
|
141
|
+
return smalltalk.send(i,"__gt",[(5)]);
|
|
142
|
+
}),"_whileFalse_",[(function(){
|
|
143
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
144
|
+
return i;
|
|
145
|
+
})]);
|
|
146
|
+
smalltalk.send(self,"_assert_equals_",[i,(6)]);
|
|
147
|
+
i=(0);
|
|
148
|
+
smalltalk.send((function(){
|
|
149
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
150
|
+
i;
|
|
151
|
+
return smalltalk.send(i,"__gt",[(5)]);
|
|
152
|
+
}),"_whileFalse",[]);
|
|
153
|
+
smalltalk.send(self,"_assert_equals_",[i,(6)]);
|
|
154
|
+
return self},
|
|
178
155
|
args: [],
|
|
179
156
|
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:", "
|
|
157
|
+
messageSends: ["whileFalse:", "+", ">", "assert:equals:", "whileFalse"],
|
|
181
158
|
referencedClasses: []
|
|
182
159
|
}),
|
|
183
160
|
smalltalk.BlockClosureTest);
|
|
@@ -189,17 +166,26 @@ selector: "testWhileTrue",
|
|
|
189
166
|
category: 'tests',
|
|
190
167
|
fn: function (){
|
|
191
168
|
var self=this;
|
|
192
|
-
var i
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
smalltalk.send(
|
|
196
|
-
(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
169
|
+
var i;
|
|
170
|
+
i=(0);
|
|
171
|
+
smalltalk.send((function(){
|
|
172
|
+
return smalltalk.send(i,"__lt",[(5)]);
|
|
173
|
+
}),"_whileTrue_",[(function(){
|
|
174
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
175
|
+
return i;
|
|
176
|
+
})]);
|
|
177
|
+
smalltalk.send(self,"_assert_equals_",[i,(5)]);
|
|
178
|
+
i=(0);
|
|
179
|
+
smalltalk.send((function(){
|
|
180
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
181
|
+
i;
|
|
182
|
+
return smalltalk.send(i,"__lt",[(5)]);
|
|
183
|
+
}),"_whileTrue",[]);
|
|
184
|
+
smalltalk.send(self,"_assert_equals_",[i,(5)]);
|
|
185
|
+
return self},
|
|
200
186
|
args: [],
|
|
201
187
|
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:", "
|
|
188
|
+
messageSends: ["whileTrue:", "+", "<", "assert:equals:", "whileTrue"],
|
|
203
189
|
referencedClasses: []
|
|
204
190
|
}),
|
|
205
191
|
smalltalk.BlockClosureTest);
|
|
@@ -214,17 +200,17 @@ selector: "testEquality",
|
|
|
214
200
|
category: 'tests',
|
|
215
201
|
fn: function (){
|
|
216
202
|
var self=this;
|
|
217
|
-
smalltalk.send(self,
|
|
218
|
-
smalltalk.send(self,
|
|
219
|
-
smalltalk.send(self,
|
|
220
|
-
smalltalk.send(self,
|
|
221
|
-
smalltalk.send(self,
|
|
222
|
-
smalltalk.send(self,
|
|
223
|
-
smalltalk.send(self,
|
|
224
|
-
smalltalk.send(self,
|
|
225
|
-
smalltalk.send(self,
|
|
226
|
-
smalltalk.send(self,
|
|
227
|
-
return self
|
|
203
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
|
|
204
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
|
|
205
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[false])]);
|
|
206
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[""])]);
|
|
207
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq",[true])]);
|
|
208
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[true])]);
|
|
209
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq",[false])]);
|
|
210
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq",[false])]);
|
|
211
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[true])]);
|
|
212
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[smalltalk.send(true,"_yourself",[])])]);
|
|
213
|
+
return self},
|
|
228
214
|
args: [],
|
|
229
215
|
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
216
|
messageSends: ["deny:", "=", "assert:", "yourself"],
|
|
@@ -239,17 +225,17 @@ selector: "testIdentity",
|
|
|
239
225
|
category: 'tests',
|
|
240
226
|
fn: function (){
|
|
241
227
|
var self=this;
|
|
242
|
-
smalltalk.send(self,
|
|
243
|
-
smalltalk.send(self,
|
|
244
|
-
smalltalk.send(self,
|
|
245
|
-
smalltalk.send(self,
|
|
246
|
-
smalltalk.send(self,
|
|
247
|
-
smalltalk.send(self,
|
|
248
|
-
smalltalk.send(self,
|
|
249
|
-
smalltalk.send(self,
|
|
250
|
-
smalltalk.send(self,
|
|
251
|
-
smalltalk.send(self,
|
|
252
|
-
return self
|
|
228
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq_eq",[false])]);
|
|
229
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[(0)])]);
|
|
230
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[false])]);
|
|
231
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[""])]);
|
|
232
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq_eq",[true])]);
|
|
233
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[true])]);
|
|
234
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq_eq",[false])]);
|
|
235
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq_eq",[false])]);
|
|
236
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[true])]);
|
|
237
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[smalltalk.send(true,"_yourself",[])])]);
|
|
238
|
+
return self},
|
|
253
239
|
args: [],
|
|
254
240
|
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
241
|
messageSends: ["deny:", "==", "assert:", "yourself"],
|
|
@@ -264,15 +250,48 @@ selector: "testIfTrueIfFalse",
|
|
|
264
250
|
category: 'tests',
|
|
265
251
|
fn: function (){
|
|
266
252
|
var self=this;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
smalltalk.send(self,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
253
|
+
var $1,$2,$3,$4,$5,$6,$7,$8;
|
|
254
|
+
if(smalltalk.assert(true)){
|
|
255
|
+
$1="alternative block";
|
|
256
|
+
};
|
|
257
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($1,"__eq",["alternative block"])]);
|
|
258
|
+
if(! smalltalk.assert(true)){
|
|
259
|
+
$2="alternative block";
|
|
260
|
+
};
|
|
261
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($2,"__eq",[nil])]);
|
|
262
|
+
if(smalltalk.assert(false)){
|
|
263
|
+
$3="alternative block";
|
|
264
|
+
};
|
|
265
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[nil])]);
|
|
266
|
+
if(! smalltalk.assert(false)){
|
|
267
|
+
$4="alternative block";
|
|
268
|
+
};
|
|
269
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($4,"__eq",["alternative block"])]);
|
|
270
|
+
if(smalltalk.assert(false)){
|
|
271
|
+
$5="alternative block";
|
|
272
|
+
} else {
|
|
273
|
+
$5="alternative block2";
|
|
274
|
+
};
|
|
275
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",["alternative block2"])]);
|
|
276
|
+
if(smalltalk.assert(false)){
|
|
277
|
+
$6="alternative block2";
|
|
278
|
+
} else {
|
|
279
|
+
$6="alternative block";
|
|
280
|
+
};
|
|
281
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($6,"__eq",["alternative block"])]);
|
|
282
|
+
if(smalltalk.assert(true)){
|
|
283
|
+
$7="alternative block";
|
|
284
|
+
} else {
|
|
285
|
+
$7="alternative block2";
|
|
286
|
+
};
|
|
287
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($7,"__eq",["alternative block"])]);
|
|
288
|
+
if(smalltalk.assert(true)){
|
|
289
|
+
$8="alternative block2";
|
|
290
|
+
} else {
|
|
291
|
+
$8="alternative block";
|
|
292
|
+
};
|
|
293
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($8,"__eq",["alternative block2"])]);
|
|
294
|
+
return self},
|
|
276
295
|
args: [],
|
|
277
296
|
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
297
|
messageSends: ["assert:", "=", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
|
|
@@ -287,11 +306,22 @@ selector: "testLogic",
|
|
|
287
306
|
category: 'tests',
|
|
288
307
|
fn: function (){
|
|
289
308
|
var self=this;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
309
|
+
var $1,$2,$3,$4;
|
|
310
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[true])]);
|
|
311
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(true,"_&",[false])]);
|
|
312
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[true])]);
|
|
313
|
+
$1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[false])]);
|
|
314
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[true])]);
|
|
315
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[false])]);
|
|
316
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[true])]);
|
|
317
|
+
$2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_|",[false])]);
|
|
318
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[smalltalk.send((1),"__gt",[(0)])])]);
|
|
319
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[false])]);
|
|
320
|
+
$3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[smalltalk.send((1),"__gt",[(2)])])]);
|
|
321
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[smalltalk.send((1),"__gt",[(0)])])]);
|
|
322
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[false])]);
|
|
323
|
+
$4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[smalltalk.send((1),"__gt",[(2)])])]);
|
|
324
|
+
return self},
|
|
295
325
|
args: [],
|
|
296
326
|
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
327
|
messageSends: ["assert:", "&", "deny:", "|", ">"],
|
|
@@ -306,11 +336,50 @@ selector: "testLogicKeywords",
|
|
|
306
336
|
category: 'tests',
|
|
307
337
|
fn: function (){
|
|
308
338
|
var self=this;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
339
|
+
var $1,$2,$3,$4;
|
|
340
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
|
|
341
|
+
return true;
|
|
342
|
+
})])]);
|
|
343
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(true,"_and_",[(function(){
|
|
344
|
+
return false;
|
|
345
|
+
})])]);
|
|
346
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
|
|
347
|
+
return true;
|
|
348
|
+
})])]);
|
|
349
|
+
$1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
|
|
350
|
+
return false;
|
|
351
|
+
})])]);
|
|
352
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
|
|
353
|
+
return true;
|
|
354
|
+
})])]);
|
|
355
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
|
|
356
|
+
return false;
|
|
357
|
+
})])]);
|
|
358
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
|
|
359
|
+
return true;
|
|
360
|
+
})])]);
|
|
361
|
+
$2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_or_",[(function(){
|
|
362
|
+
return false;
|
|
363
|
+
})])]);
|
|
364
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
|
|
365
|
+
return smalltalk.send((1),"__gt",[(0)]);
|
|
366
|
+
})])]);
|
|
367
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
|
|
368
|
+
return false;
|
|
369
|
+
})])]);
|
|
370
|
+
$3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
|
|
371
|
+
return smalltalk.send((1),"__gt",[(2)]);
|
|
372
|
+
})])]);
|
|
373
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
|
|
374
|
+
return smalltalk.send((1),"__gt",[(0)]);
|
|
375
|
+
})])]);
|
|
376
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
|
|
377
|
+
return false;
|
|
378
|
+
})])]);
|
|
379
|
+
$4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
|
|
380
|
+
return smalltalk.send((1),"__gt",[(2)]);
|
|
381
|
+
})])]);
|
|
382
|
+
return self},
|
|
314
383
|
args: [],
|
|
315
384
|
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
385
|
messageSends: ["assert:", "and:", "deny:", "or:", ">"],
|
|
@@ -328,8 +397,8 @@ selector: "setUp",
|
|
|
328
397
|
category: 'running',
|
|
329
398
|
fn: function (){
|
|
330
399
|
var self=this;
|
|
331
|
-
|
|
332
|
-
return self
|
|
400
|
+
self["@builder"]=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]);
|
|
401
|
+
return self},
|
|
333
402
|
args: [],
|
|
334
403
|
source: "setUp\x0a\x09builder := ClassBuilder new",
|
|
335
404
|
messageSends: ["new"],
|
|
@@ -344,8 +413,14 @@ selector: "tearDown",
|
|
|
344
413
|
category: 'running',
|
|
345
414
|
fn: function (){
|
|
346
415
|
var self=this;
|
|
347
|
-
(($receiver = self[
|
|
348
|
-
|
|
416
|
+
if(($receiver = self["@theClass"]) == nil || $receiver == undefined){
|
|
417
|
+
self["@theClass"];
|
|
418
|
+
} else {
|
|
419
|
+
smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_removeClass_",[self["@theClass"]]);
|
|
420
|
+
self["@theClass"]=nil;
|
|
421
|
+
self["@theClass"];
|
|
422
|
+
};
|
|
423
|
+
return self},
|
|
349
424
|
args: [],
|
|
350
425
|
source: "tearDown\x0a\x09theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]",
|
|
351
426
|
messageSends: ["ifNotNil:", "removeClass:", "current"],
|
|
@@ -360,13 +435,13 @@ selector: "testClassCopy",
|
|
|
360
435
|
category: 'running',
|
|
361
436
|
fn: function (){
|
|
362
437
|
var self=this;
|
|
363
|
-
|
|
364
|
-
smalltalk.send(self,
|
|
365
|
-
smalltalk.send(self,
|
|
366
|
-
smalltalk.send(self,
|
|
367
|
-
smalltalk.send(self,
|
|
368
|
-
smalltalk.send(self,
|
|
369
|
-
return self
|
|
438
|
+
self["@theClass"]=smalltalk.send(self["@builder"],"_copyClass_named_",[(smalltalk.ObjectMock || ObjectMock),"ObjectMock2"]);
|
|
439
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_superclass",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_superclass",[])])]);
|
|
440
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_instanceVariableNames",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_instanceVariableNames",[])])]);
|
|
441
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@theClass"],"_name",[]),"ObjectMock2"]);
|
|
442
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_package",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_package",[])])]);
|
|
443
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self["@theClass"],"_methodDictionary",[]),"_keys",[]),smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_methodDictionary",[]),"_keys",[])]);
|
|
444
|
+
return self},
|
|
370
445
|
args: [],
|
|
371
446
|
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
447
|
messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
|
|
@@ -381,8 +456,8 @@ selector: "testInstanceVariableNames",
|
|
|
381
456
|
category: 'running',
|
|
382
457
|
fn: function (){
|
|
383
458
|
var self=this;
|
|
384
|
-
smalltalk.send(self,
|
|
385
|
-
return self
|
|
459
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@builder"],"_instanceVariableNamesFor_",[" hello world "]),["hello", "world"]]);
|
|
460
|
+
return self},
|
|
386
461
|
args: [],
|
|
387
462
|
source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
|
|
388
463
|
messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
|
|
@@ -392,1511 +467,2546 @@ smalltalk.ClassBuilderTest);
|
|
|
392
467
|
|
|
393
468
|
|
|
394
469
|
|
|
395
|
-
smalltalk.addClass('
|
|
470
|
+
smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
396
471
|
smalltalk.addMethod(
|
|
397
|
-
"
|
|
472
|
+
"_assertSameContents_as_",
|
|
398
473
|
smalltalk.method({
|
|
399
|
-
selector: "
|
|
400
|
-
category: '
|
|
401
|
-
fn: function (){
|
|
474
|
+
selector: "assertSameContents:as:",
|
|
475
|
+
category: 'convenience',
|
|
476
|
+
fn: function (aCollection,anotherCollection){
|
|
402
477
|
var self=this;
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
smalltalk.send(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
|
|
413
|
-
return self;},
|
|
414
|
-
args: [],
|
|
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:", "@"],
|
|
417
|
-
referencedClasses: ["Dictionary"]
|
|
478
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_size",[]),"__eq",[smalltalk.send(anotherCollection,"_size",[])])]);
|
|
479
|
+
smalltalk.send(aCollection,"_do_",[(function(each){
|
|
480
|
+
return smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_occurrencesOf_",[each]),"__eq",[smalltalk.send(anotherCollection,"_occurrencesOf_",[each])])]);
|
|
481
|
+
})]);
|
|
482
|
+
return self},
|
|
483
|
+
args: ["aCollection", "anotherCollection"],
|
|
484
|
+
source: "assertSameContents: aCollection \x09as: anotherCollection\x0a\x09self assert: aCollection size = anotherCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: (aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each) ]",
|
|
485
|
+
messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
|
|
486
|
+
referencedClasses: []
|
|
418
487
|
}),
|
|
419
|
-
smalltalk.
|
|
488
|
+
smalltalk.CollectionTest);
|
|
420
489
|
|
|
421
490
|
smalltalk.addMethod(
|
|
422
|
-
"
|
|
491
|
+
"_collection",
|
|
423
492
|
smalltalk.method({
|
|
424
|
-
selector: "
|
|
425
|
-
category: '
|
|
493
|
+
selector: "collection",
|
|
494
|
+
category: 'accessing',
|
|
426
495
|
fn: function (){
|
|
427
496
|
var self=this;
|
|
428
|
-
|
|
429
|
-
|
|
497
|
+
var $1;
|
|
498
|
+
$1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[smalltalk.send(self,"_defaultValues",[])]);
|
|
499
|
+
return $1;
|
|
500
|
+
},
|
|
430
501
|
args: [],
|
|
431
|
-
source: "
|
|
432
|
-
messageSends: ["
|
|
433
|
-
referencedClasses: [
|
|
502
|
+
source: "collection\x0a\x09^ self collectionClass withAll: self defaultValues",
|
|
503
|
+
messageSends: ["withAll:", "defaultValues", "collectionClass"],
|
|
504
|
+
referencedClasses: []
|
|
434
505
|
}),
|
|
435
|
-
smalltalk.
|
|
506
|
+
smalltalk.CollectionTest);
|
|
436
507
|
|
|
437
508
|
smalltalk.addMethod(
|
|
438
|
-
"
|
|
509
|
+
"_collectionClass",
|
|
439
510
|
smalltalk.method({
|
|
440
|
-
selector: "
|
|
441
|
-
category: '
|
|
511
|
+
selector: "collectionClass",
|
|
512
|
+
category: 'accessing',
|
|
442
513
|
fn: function (){
|
|
443
514
|
var self=this;
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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])]);
|
|
456
|
-
return self;},
|
|
515
|
+
var $1;
|
|
516
|
+
$1=smalltalk.send(smalltalk.send(self,"_class",[]),"_collectionClass",[]);
|
|
517
|
+
return $1;
|
|
518
|
+
},
|
|
457
519
|
args: [],
|
|
458
|
-
source: "
|
|
459
|
-
messageSends: ["
|
|
460
|
-
referencedClasses: [
|
|
520
|
+
source: "collectionClass\x0a\x09^ self class collectionClass",
|
|
521
|
+
messageSends: ["collectionClass", "class"],
|
|
522
|
+
referencedClasses: []
|
|
461
523
|
}),
|
|
462
|
-
smalltalk.
|
|
524
|
+
smalltalk.CollectionTest);
|
|
463
525
|
|
|
464
526
|
smalltalk.addMethod(
|
|
465
|
-
"
|
|
527
|
+
"_collectionWithDuplicates",
|
|
466
528
|
smalltalk.method({
|
|
467
|
-
selector: "
|
|
468
|
-
category: '
|
|
529
|
+
selector: "collectionWithDuplicates",
|
|
530
|
+
category: 'accessing',
|
|
469
531
|
fn: function (){
|
|
470
532
|
var self=this;
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
smalltalk.send(d, "_at_put_", [(3), (4)]);
|
|
476
|
-
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
|
|
477
|
-
return self;},
|
|
533
|
+
var $1;
|
|
534
|
+
$1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[["a", "b", "c", (1), (2), (1), "a"]]);
|
|
535
|
+
return $1;
|
|
536
|
+
},
|
|
478
537
|
args: [],
|
|
479
|
-
source: "
|
|
480
|
-
messageSends: ["
|
|
481
|
-
referencedClasses: [
|
|
538
|
+
source: "collectionWithDuplicates\x0a\x09^ self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a')",
|
|
539
|
+
messageSends: ["withAll:", "collectionClass"],
|
|
540
|
+
referencedClasses: []
|
|
482
541
|
}),
|
|
483
|
-
smalltalk.
|
|
542
|
+
smalltalk.CollectionTest);
|
|
484
543
|
|
|
485
544
|
smalltalk.addMethod(
|
|
486
|
-
"
|
|
545
|
+
"_defaultValues",
|
|
487
546
|
smalltalk.method({
|
|
488
|
-
selector: "
|
|
489
|
-
category: '
|
|
547
|
+
selector: "defaultValues",
|
|
548
|
+
category: 'accessing',
|
|
490
549
|
fn: function (){
|
|
491
550
|
var self=this;
|
|
492
|
-
|
|
493
|
-
|
|
551
|
+
return [(1), (2), (3), (-4)];
|
|
552
|
+
},
|
|
494
553
|
args: [],
|
|
495
|
-
source: "
|
|
496
|
-
messageSends: [
|
|
497
|
-
referencedClasses: [
|
|
554
|
+
source: "defaultValues\x0a\x09^ #(1 2 3 -4)",
|
|
555
|
+
messageSends: [],
|
|
556
|
+
referencedClasses: []
|
|
498
557
|
}),
|
|
499
|
-
smalltalk.
|
|
558
|
+
smalltalk.CollectionTest);
|
|
500
559
|
|
|
501
560
|
smalltalk.addMethod(
|
|
502
|
-
"
|
|
561
|
+
"_isCollectionReadOnly",
|
|
503
562
|
smalltalk.method({
|
|
504
|
-
selector: "
|
|
505
|
-
category: '
|
|
563
|
+
selector: "isCollectionReadOnly",
|
|
564
|
+
category: 'testing',
|
|
506
565
|
fn: function (){
|
|
507
566
|
var self=this;
|
|
508
|
-
|
|
509
|
-
|
|
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)])]);
|
|
520
|
-
return self;},
|
|
567
|
+
return false;
|
|
568
|
+
},
|
|
521
569
|
args: [],
|
|
522
|
-
source: "
|
|
523
|
-
messageSends: [
|
|
524
|
-
referencedClasses: [
|
|
570
|
+
source: "isCollectionReadOnly\x0a\x09^ false",
|
|
571
|
+
messageSends: [],
|
|
572
|
+
referencedClasses: []
|
|
525
573
|
}),
|
|
526
|
-
smalltalk.
|
|
574
|
+
smalltalk.CollectionTest);
|
|
527
575
|
|
|
528
576
|
smalltalk.addMethod(
|
|
529
|
-
"
|
|
577
|
+
"_testAsArray",
|
|
530
578
|
smalltalk.method({
|
|
531
|
-
selector: "
|
|
579
|
+
selector: "testAsArray",
|
|
532
580
|
category: 'tests',
|
|
533
581
|
fn: function (){
|
|
534
582
|
var self=this;
|
|
535
|
-
|
|
536
|
-
|
|
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)])]);
|
|
547
|
-
return self;},
|
|
583
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asArray",[])]);
|
|
584
|
+
return self},
|
|
548
585
|
args: [],
|
|
549
|
-
source: "
|
|
550
|
-
messageSends: ["
|
|
551
|
-
referencedClasses: [
|
|
586
|
+
source: "testAsArray\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asArray",
|
|
587
|
+
messageSends: ["assertSameContents:as:", "collection", "asArray"],
|
|
588
|
+
referencedClasses: []
|
|
552
589
|
}),
|
|
553
|
-
smalltalk.
|
|
590
|
+
smalltalk.CollectionTest);
|
|
554
591
|
|
|
555
592
|
smalltalk.addMethod(
|
|
556
|
-
"
|
|
593
|
+
"_testAsOrderedCollection",
|
|
557
594
|
smalltalk.method({
|
|
558
|
-
selector: "
|
|
595
|
+
selector: "testAsOrderedCollection",
|
|
559
596
|
category: 'tests',
|
|
560
597
|
fn: function (){
|
|
561
598
|
var self=this;
|
|
562
|
-
|
|
563
|
-
|
|
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)])]);
|
|
569
|
-
return self;},
|
|
599
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asOrderedCollection",[])]);
|
|
600
|
+
return self},
|
|
570
601
|
args: [],
|
|
571
|
-
source: "
|
|
572
|
-
messageSends: ["
|
|
573
|
-
referencedClasses: [
|
|
602
|
+
source: "testAsOrderedCollection\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: self collection asOrderedCollection",
|
|
603
|
+
messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
|
|
604
|
+
referencedClasses: []
|
|
574
605
|
}),
|
|
575
|
-
smalltalk.
|
|
606
|
+
smalltalk.CollectionTest);
|
|
576
607
|
|
|
577
608
|
smalltalk.addMethod(
|
|
578
|
-
"
|
|
609
|
+
"_testAsSet",
|
|
579
610
|
smalltalk.method({
|
|
580
|
-
selector: "
|
|
611
|
+
selector: "testAsSet",
|
|
581
612
|
category: 'tests',
|
|
582
613
|
fn: function (){
|
|
583
614
|
var self=this;
|
|
584
|
-
var
|
|
585
|
-
|
|
586
|
-
smalltalk.send(
|
|
587
|
-
smalltalk.send(
|
|
588
|
-
smalltalk.send(
|
|
589
|
-
smalltalk.send(
|
|
590
|
-
return self;
|
|
615
|
+
var c;
|
|
616
|
+
var set;
|
|
617
|
+
c=smalltalk.send(self,"_collectionWithDuplicates",[]);
|
|
618
|
+
set=smalltalk.send(c,"_asSet",[]);
|
|
619
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(5)])]);
|
|
620
|
+
smalltalk.send(c,"_do_",[(function(each){
|
|
621
|
+
return smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[each])]);
|
|
622
|
+
})]);
|
|
623
|
+
return self},
|
|
591
624
|
args: [],
|
|
592
|
-
source: "
|
|
593
|
-
messageSends: ["
|
|
594
|
-
referencedClasses: [
|
|
625
|
+
source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size = 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
|
|
626
|
+
messageSends: ["collectionWithDuplicates", "asSet", "assert:", "=", "size", "do:", "includes:"],
|
|
627
|
+
referencedClasses: []
|
|
595
628
|
}),
|
|
596
|
-
smalltalk.
|
|
629
|
+
smalltalk.CollectionTest);
|
|
597
630
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
601
631
|
smalltalk.addMethod(
|
|
602
|
-
"
|
|
632
|
+
"_testCollect",
|
|
603
633
|
smalltalk.method({
|
|
604
|
-
selector: "
|
|
605
|
-
category: '
|
|
634
|
+
selector: "testCollect",
|
|
635
|
+
category: 'tests',
|
|
606
636
|
fn: function (){
|
|
607
637
|
var self=this;
|
|
608
|
-
|
|
609
|
-
|
|
638
|
+
var newCollection;
|
|
639
|
+
newCollection=[(1), (2), (3), (4)];
|
|
640
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
|
|
641
|
+
return smalltalk.send(each,"_abs",[]);
|
|
642
|
+
})]),newCollection]);
|
|
643
|
+
return self},
|
|
610
644
|
args: [],
|
|
611
|
-
source: "
|
|
612
|
-
messageSends: [],
|
|
645
|
+
source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
|
|
646
|
+
messageSends: ["assertSameContents:as:", "collect:", "abs", "collection"],
|
|
613
647
|
referencedClasses: []
|
|
614
648
|
}),
|
|
615
|
-
smalltalk.
|
|
649
|
+
smalltalk.CollectionTest);
|
|
616
650
|
|
|
617
651
|
smalltalk.addMethod(
|
|
618
|
-
"
|
|
652
|
+
"_testDetect",
|
|
619
653
|
smalltalk.method({
|
|
620
|
-
selector: "
|
|
654
|
+
selector: "testDetect",
|
|
621
655
|
category: 'tests',
|
|
622
656
|
fn: function (){
|
|
623
657
|
var self=this;
|
|
624
|
-
smalltalk.send(self,
|
|
625
|
-
return
|
|
658
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
659
|
+
return smalltalk.send(each,"__lt",[(0)]);
|
|
660
|
+
})]),"__eq",[(-4)])]);
|
|
661
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
662
|
+
return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
663
|
+
return smalltalk.send(each,"__eq",[(6)]);
|
|
664
|
+
})]);
|
|
665
|
+
}),(smalltalk.Error || Error)]);
|
|
666
|
+
return self},
|
|
626
667
|
args: [],
|
|
627
|
-
source: "
|
|
628
|
-
messageSends: ["
|
|
629
|
-
referencedClasses: ["
|
|
668
|
+
source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) = -4.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
|
|
669
|
+
messageSends: ["assert:", "=", "detect:", "<", "collection", "should:raise:"],
|
|
670
|
+
referencedClasses: ["Error"]
|
|
630
671
|
}),
|
|
631
|
-
smalltalk.
|
|
672
|
+
smalltalk.CollectionTest);
|
|
632
673
|
|
|
633
674
|
smalltalk.addMethod(
|
|
634
|
-
"
|
|
675
|
+
"_testDo",
|
|
635
676
|
smalltalk.method({
|
|
636
|
-
selector: "
|
|
677
|
+
selector: "testDo",
|
|
637
678
|
category: 'tests',
|
|
638
679
|
fn: function (){
|
|
639
680
|
var self=this;
|
|
640
|
-
|
|
641
|
-
smalltalk.send(
|
|
642
|
-
smalltalk.send(
|
|
643
|
-
return
|
|
681
|
+
var newCollection;
|
|
682
|
+
newCollection=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
|
|
683
|
+
smalltalk.send(smalltalk.send(self,"_collection",[]),"_do_",[(function(each){
|
|
684
|
+
return smalltalk.send(newCollection,"_add_",[each]);
|
|
685
|
+
})]);
|
|
686
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),newCollection]);
|
|
687
|
+
return self},
|
|
644
688
|
args: [],
|
|
645
|
-
source: "
|
|
646
|
-
messageSends: ["
|
|
647
|
-
referencedClasses: []
|
|
689
|
+
source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self \x0a\x09\x09assertSameContents: self collection \x0a\x09\x09as: newCollection",
|
|
690
|
+
messageSends: ["new", "do:", "add:", "collection", "assertSameContents:as:"],
|
|
691
|
+
referencedClasses: ["OrderedCollection"]
|
|
648
692
|
}),
|
|
649
|
-
smalltalk.
|
|
693
|
+
smalltalk.CollectionTest);
|
|
650
694
|
|
|
651
695
|
smalltalk.addMethod(
|
|
652
|
-
"
|
|
696
|
+
"_testIsEmpty",
|
|
653
697
|
smalltalk.method({
|
|
654
|
-
selector: "
|
|
698
|
+
selector: "testIsEmpty",
|
|
655
699
|
category: 'tests',
|
|
656
700
|
fn: function (){
|
|
657
701
|
var self=this;
|
|
658
|
-
smalltalk.send(self,
|
|
659
|
-
smalltalk.send(smalltalk.send(
|
|
660
|
-
|
|
661
|
-
smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
|
|
662
|
-
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
|
|
663
|
-
return self;},
|
|
702
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_isEmpty",[])]);
|
|
703
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
|
|
704
|
+
return self},
|
|
664
705
|
args: [],
|
|
665
|
-
source: "
|
|
666
|
-
messageSends: ["
|
|
706
|
+
source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
|
|
707
|
+
messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
|
|
667
708
|
referencedClasses: []
|
|
668
709
|
}),
|
|
669
|
-
smalltalk.
|
|
710
|
+
smalltalk.CollectionTest);
|
|
670
711
|
|
|
671
712
|
smalltalk.addMethod(
|
|
672
|
-
"
|
|
713
|
+
"_testSelect",
|
|
673
714
|
smalltalk.method({
|
|
674
|
-
selector: "
|
|
715
|
+
selector: "testSelect",
|
|
675
716
|
category: 'tests',
|
|
676
717
|
fn: function (){
|
|
677
718
|
var self=this;
|
|
678
|
-
|
|
679
|
-
|
|
719
|
+
var newCollection;
|
|
720
|
+
newCollection=[(2), (-4)];
|
|
721
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
|
|
722
|
+
return smalltalk.send(each,"_even",[]);
|
|
723
|
+
})]),newCollection]);
|
|
724
|
+
return self},
|
|
680
725
|
args: [],
|
|
681
|
-
source: "
|
|
682
|
-
messageSends: ["
|
|
726
|
+
source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
|
|
727
|
+
messageSends: ["assertSameContents:as:", "select:", "even", "collection"],
|
|
683
728
|
referencedClasses: []
|
|
684
729
|
}),
|
|
685
|
-
smalltalk.
|
|
730
|
+
smalltalk.CollectionTest);
|
|
686
731
|
|
|
687
732
|
smalltalk.addMethod(
|
|
688
|
-
"
|
|
733
|
+
"_testSize",
|
|
689
734
|
smalltalk.method({
|
|
690
|
-
selector: "
|
|
735
|
+
selector: "testSize",
|
|
691
736
|
category: 'tests',
|
|
692
737
|
fn: function (){
|
|
693
738
|
var self=this;
|
|
694
|
-
|
|
695
|
-
smalltalk.send(self,
|
|
696
|
-
|
|
697
|
-
smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
|
|
698
|
-
return self;},
|
|
739
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_size",[]),"__eq",[(0)])]);
|
|
740
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__eq",[(4)])]);
|
|
741
|
+
return self},
|
|
699
742
|
args: [],
|
|
700
|
-
source: "
|
|
701
|
-
messageSends: ["assert:
|
|
743
|
+
source: "testSize\x0a\x09self assert: self collectionClass new size = 0.\x0a\x09self assert: self collection size = 4",
|
|
744
|
+
messageSends: ["assert:", "=", "size", "new", "collectionClass", "collection"],
|
|
702
745
|
referencedClasses: []
|
|
703
746
|
}),
|
|
704
|
-
smalltalk.
|
|
747
|
+
smalltalk.CollectionTest);
|
|
748
|
+
|
|
705
749
|
|
|
706
750
|
smalltalk.addMethod(
|
|
707
|
-
"
|
|
751
|
+
"_collectionClass",
|
|
708
752
|
smalltalk.method({
|
|
709
|
-
selector: "
|
|
710
|
-
category: '
|
|
753
|
+
selector: "collectionClass",
|
|
754
|
+
category: 'accessing',
|
|
711
755
|
fn: function (){
|
|
712
756
|
var self=this;
|
|
713
|
-
|
|
714
|
-
|
|
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"])]);
|
|
718
|
-
return self;},
|
|
757
|
+
return nil;
|
|
758
|
+
},
|
|
719
759
|
args: [],
|
|
720
|
-
source: "
|
|
721
|
-
messageSends: [
|
|
760
|
+
source: "collectionClass\x0a\x09^ nil",
|
|
761
|
+
messageSends: [],
|
|
722
762
|
referencedClasses: []
|
|
723
763
|
}),
|
|
724
|
-
smalltalk.
|
|
725
|
-
|
|
726
|
-
|
|
764
|
+
smalltalk.CollectionTest.klass);
|
|
727
765
|
|
|
728
|
-
smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
729
766
|
smalltalk.addMethod(
|
|
730
|
-
"
|
|
767
|
+
"_isAbstract",
|
|
731
768
|
smalltalk.method({
|
|
732
|
-
selector: "
|
|
733
|
-
category: '
|
|
769
|
+
selector: "isAbstract",
|
|
770
|
+
category: 'testing',
|
|
734
771
|
fn: function (){
|
|
735
772
|
var self=this;
|
|
736
|
-
|
|
737
|
-
smalltalk.send(self,
|
|
738
|
-
|
|
739
|
-
|
|
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)])]);
|
|
743
|
-
return self;},
|
|
773
|
+
var $1;
|
|
774
|
+
$1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_isNil",[]);
|
|
775
|
+
return $1;
|
|
776
|
+
},
|
|
744
777
|
args: [],
|
|
745
|
-
source: "
|
|
746
|
-
messageSends: ["
|
|
778
|
+
source: "isAbstract\x0a\x09^ self collectionClass isNil",
|
|
779
|
+
messageSends: ["isNil", "collectionClass"],
|
|
747
780
|
referencedClasses: []
|
|
748
781
|
}),
|
|
749
|
-
smalltalk.
|
|
782
|
+
smalltalk.CollectionTest.klass);
|
|
750
783
|
|
|
784
|
+
|
|
785
|
+
smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
|
|
751
786
|
smalltalk.addMethod(
|
|
752
|
-
"
|
|
787
|
+
"_collection",
|
|
753
788
|
smalltalk.method({
|
|
754
|
-
selector: "
|
|
755
|
-
category: '
|
|
789
|
+
selector: "collection",
|
|
790
|
+
category: 'accessing',
|
|
756
791
|
fn: function (){
|
|
757
792
|
var self=this;
|
|
758
|
-
|
|
759
|
-
smalltalk.send(
|
|
760
|
-
|
|
761
|
-
|
|
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)]);
|
|
766
|
-
return self;},
|
|
793
|
+
var $1;
|
|
794
|
+
$1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)])]);
|
|
795
|
+
return $1;
|
|
796
|
+
},
|
|
767
797
|
args: [],
|
|
768
|
-
source: "
|
|
769
|
-
messageSends: ["
|
|
798
|
+
source: "collection\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4 }",
|
|
799
|
+
messageSends: ["->"],
|
|
770
800
|
referencedClasses: []
|
|
771
801
|
}),
|
|
772
|
-
smalltalk.
|
|
802
|
+
smalltalk.HashedCollectionTest);
|
|
773
803
|
|
|
774
804
|
smalltalk.addMethod(
|
|
775
|
-
"
|
|
805
|
+
"_collectionWithDuplicates",
|
|
776
806
|
smalltalk.method({
|
|
777
|
-
selector: "
|
|
778
|
-
category: '
|
|
807
|
+
selector: "collectionWithDuplicates",
|
|
808
|
+
category: 'accessing',
|
|
779
809
|
fn: function (){
|
|
780
810
|
var self=this;
|
|
781
|
-
|
|
782
|
-
smalltalk.send(
|
|
783
|
-
return
|
|
811
|
+
var $1;
|
|
812
|
+
$1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)]),smalltalk.send("e","__minus_gt",[(1)]),smalltalk.send("f","__minus_gt",[(2)]),smalltalk.send("g","__minus_gt",[(10)])]);
|
|
813
|
+
return $1;
|
|
814
|
+
},
|
|
784
815
|
args: [],
|
|
785
|
-
source: "
|
|
786
|
-
messageSends: ["
|
|
816
|
+
source: "collectionWithDuplicates\x0a\x09^ #{ 'a' -> 1. 'b' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
|
|
817
|
+
messageSends: ["->"],
|
|
787
818
|
referencedClasses: []
|
|
788
819
|
}),
|
|
789
|
-
smalltalk.
|
|
820
|
+
smalltalk.HashedCollectionTest);
|
|
821
|
+
|
|
790
822
|
|
|
791
823
|
smalltalk.addMethod(
|
|
792
|
-
"
|
|
824
|
+
"_collectionClass",
|
|
793
825
|
smalltalk.method({
|
|
794
|
-
selector: "
|
|
795
|
-
category: '
|
|
826
|
+
selector: "collectionClass",
|
|
827
|
+
category: 'accessing',
|
|
796
828
|
fn: function (){
|
|
797
829
|
var self=this;
|
|
798
|
-
|
|
799
|
-
|
|
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", [""])]);
|
|
808
|
-
return self;},
|
|
830
|
+
return (smalltalk.HashedCollection || HashedCollection);
|
|
831
|
+
},
|
|
809
832
|
args: [],
|
|
810
|
-
source: "
|
|
811
|
-
messageSends: [
|
|
812
|
-
referencedClasses: []
|
|
833
|
+
source: "collectionClass\x0a\x09^ HashedCollection",
|
|
834
|
+
messageSends: [],
|
|
835
|
+
referencedClasses: ["HashedCollection"]
|
|
813
836
|
}),
|
|
814
|
-
smalltalk.
|
|
837
|
+
smalltalk.HashedCollectionTest.klass);
|
|
838
|
+
|
|
815
839
|
|
|
840
|
+
smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
|
|
816
841
|
smalltalk.addMethod(
|
|
817
|
-
"
|
|
842
|
+
"_collection",
|
|
818
843
|
smalltalk.method({
|
|
819
|
-
selector: "
|
|
820
|
-
category: '
|
|
844
|
+
selector: "collection",
|
|
845
|
+
category: 'accessing',
|
|
821
846
|
fn: function (){
|
|
822
847
|
var self=this;
|
|
823
|
-
|
|
824
|
-
smalltalk.send(
|
|
825
|
-
smalltalk.send(
|
|
826
|
-
smalltalk.send(
|
|
827
|
-
smalltalk.send(
|
|
828
|
-
smalltalk.send(
|
|
829
|
-
smalltalk.send(
|
|
830
|
-
|
|
848
|
+
var $2,$3,$1;
|
|
849
|
+
$2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
850
|
+
smalltalk.send($2,"_at_put_",[(1),(1)]);
|
|
851
|
+
smalltalk.send($2,"_at_put_",["a",(2)]);
|
|
852
|
+
smalltalk.send($2,"_at_put_",[true,(3)]);
|
|
853
|
+
smalltalk.send($2,"_at_put_",[(4),(-4)]);
|
|
854
|
+
$3=smalltalk.send($2,"_yourself",[]);
|
|
855
|
+
$1=$3;
|
|
856
|
+
return $1;
|
|
857
|
+
},
|
|
831
858
|
args: [],
|
|
832
|
-
source: "
|
|
833
|
-
messageSends: ["
|
|
834
|
-
referencedClasses: []
|
|
859
|
+
source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09yourself",
|
|
860
|
+
messageSends: ["at:put:", "new", "yourself"],
|
|
861
|
+
referencedClasses: ["Dictionary"]
|
|
835
862
|
}),
|
|
836
|
-
smalltalk.
|
|
863
|
+
smalltalk.DictionaryTest);
|
|
837
864
|
|
|
838
865
|
smalltalk.addMethod(
|
|
839
|
-
"
|
|
866
|
+
"_collectionWithDuplicates",
|
|
840
867
|
smalltalk.method({
|
|
841
|
-
selector: "
|
|
842
|
-
category: '
|
|
868
|
+
selector: "collectionWithDuplicates",
|
|
869
|
+
category: 'accessing',
|
|
843
870
|
fn: function (){
|
|
844
871
|
var self=this;
|
|
845
|
-
|
|
846
|
-
smalltalk.send(
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
872
|
+
var $2,$3,$1;
|
|
873
|
+
$2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
874
|
+
smalltalk.send($2,"_at_put_",[(1),(1)]);
|
|
875
|
+
smalltalk.send($2,"_at_put_",["a",(2)]);
|
|
876
|
+
smalltalk.send($2,"_at_put_",[true,(3)]);
|
|
877
|
+
smalltalk.send($2,"_at_put_",[(4),(-4)]);
|
|
878
|
+
smalltalk.send($2,"_at_put_",["b",(1)]);
|
|
879
|
+
smalltalk.send($2,"_at_put_",[(3),(3)]);
|
|
880
|
+
smalltalk.send($2,"_at_put_",[false,(12)]);
|
|
881
|
+
$3=smalltalk.send($2,"_yourself",[]);
|
|
882
|
+
$1=$3;
|
|
883
|
+
return $1;
|
|
884
|
+
},
|
|
885
|
+
args: [],
|
|
886
|
+
source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
|
|
887
|
+
messageSends: ["at:put:", "new", "yourself"],
|
|
888
|
+
referencedClasses: ["Dictionary"]
|
|
852
889
|
}),
|
|
853
|
-
smalltalk.
|
|
890
|
+
smalltalk.DictionaryTest);
|
|
854
891
|
|
|
855
892
|
smalltalk.addMethod(
|
|
856
|
-
"
|
|
893
|
+
"_testAccessing",
|
|
857
894
|
smalltalk.method({
|
|
858
|
-
selector: "
|
|
895
|
+
selector: "testAccessing",
|
|
859
896
|
category: 'tests',
|
|
860
897
|
fn: function (){
|
|
861
898
|
var self=this;
|
|
862
|
-
|
|
863
|
-
smalltalk.send(
|
|
864
|
-
|
|
899
|
+
var d;
|
|
900
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
901
|
+
smalltalk.send(d,"_at_put_",["hello","world"]);
|
|
902
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",["hello"]),"__eq",["world"])]);
|
|
903
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
|
|
904
|
+
return nil;
|
|
905
|
+
})]),"__eq",["world"])]);
|
|
906
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["foo",(function(){
|
|
907
|
+
return nil;
|
|
908
|
+
})]),"__eq",["world"])]);
|
|
909
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
910
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[(1)]),"__eq",[(2)])]);
|
|
911
|
+
smalltalk.send(d,"_at_put_",[smalltalk.send((1),"__at",[(3)]),(3)]);
|
|
912
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[smalltalk.send((1),"__at",[(3)])]),"__eq",[(3)])]);
|
|
913
|
+
return self},
|
|
865
914
|
args: [],
|
|
866
|
-
source: "
|
|
867
|
-
messageSends: ["assert:", "=", "
|
|
868
|
-
referencedClasses: []
|
|
915
|
+
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",
|
|
916
|
+
messageSends: ["new", "at:put:", "assert:", "=", "at:", "at:ifAbsent:", "deny:", "@"],
|
|
917
|
+
referencedClasses: ["Dictionary"]
|
|
869
918
|
}),
|
|
870
|
-
smalltalk.
|
|
919
|
+
smalltalk.DictionaryTest);
|
|
871
920
|
|
|
872
921
|
smalltalk.addMethod(
|
|
873
|
-
"
|
|
922
|
+
"_testDynamicDictionaries",
|
|
874
923
|
smalltalk.method({
|
|
875
|
-
selector: "
|
|
924
|
+
selector: "testDynamicDictionaries",
|
|
876
925
|
category: 'tests',
|
|
877
926
|
fn: function (){
|
|
878
927
|
var self=this;
|
|
879
|
-
smalltalk.send(self,
|
|
880
|
-
|
|
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)])]);
|
|
892
|
-
return self;},
|
|
928
|
+
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)])])])]);
|
|
929
|
+
return self},
|
|
893
930
|
args: [],
|
|
894
|
-
source: "
|
|
895
|
-
messageSends: ["assert:
|
|
896
|
-
referencedClasses: []
|
|
931
|
+
source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary = (Dictionary with: 'hello' -> 1)",
|
|
932
|
+
messageSends: ["assert:", "=", "with:", "->", "asDictionary"],
|
|
933
|
+
referencedClasses: ["Dictionary"]
|
|
897
934
|
}),
|
|
898
|
-
smalltalk.
|
|
935
|
+
smalltalk.DictionaryTest);
|
|
899
936
|
|
|
900
937
|
smalltalk.addMethod(
|
|
901
|
-
"
|
|
938
|
+
"_testEquality",
|
|
902
939
|
smalltalk.method({
|
|
903
|
-
selector: "
|
|
940
|
+
selector: "testEquality",
|
|
904
941
|
category: 'tests',
|
|
905
942
|
fn: function (){
|
|
906
943
|
var self=this;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
944
|
+
var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
|
|
945
|
+
var d1;
|
|
946
|
+
var d2;
|
|
947
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]),"__eq",[smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[])])]);
|
|
948
|
+
$1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
949
|
+
smalltalk.send($1,"_at_put_",[(1),(2)]);
|
|
950
|
+
$2=smalltalk.send($1,"_yourself",[]);
|
|
951
|
+
d1=$2;
|
|
952
|
+
$3=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
953
|
+
smalltalk.send($3,"_at_put_",[(1),(2)]);
|
|
954
|
+
$4=smalltalk.send($3,"_yourself",[]);
|
|
955
|
+
d2=$4;
|
|
956
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(d1,"__eq",[d2])]);
|
|
957
|
+
$5=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
958
|
+
smalltalk.send($5,"_at_put_",[(1),(3)]);
|
|
959
|
+
$6=smalltalk.send($5,"_yourself",[]);
|
|
960
|
+
d2=$6;
|
|
961
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
|
|
962
|
+
$7=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
963
|
+
smalltalk.send($7,"_at_put_",[(2),(2)]);
|
|
964
|
+
$8=smalltalk.send($7,"_yourself",[]);
|
|
965
|
+
d2=$8;
|
|
966
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
|
|
967
|
+
$9=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
968
|
+
smalltalk.send($9,"_at_put_",[(1),(2)]);
|
|
969
|
+
smalltalk.send($9,"_at_put_",[(3),(4)]);
|
|
970
|
+
$10=smalltalk.send($9,"_yourself",[]);
|
|
971
|
+
d2=$10;
|
|
972
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
|
|
973
|
+
return self},
|
|
911
974
|
args: [],
|
|
912
|
-
source: "
|
|
913
|
-
messageSends: ["assert:", "=", "
|
|
914
|
-
referencedClasses: []
|
|
975
|
+
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.",
|
|
976
|
+
messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
|
|
977
|
+
referencedClasses: ["Dictionary"]
|
|
915
978
|
}),
|
|
916
|
-
smalltalk.
|
|
979
|
+
smalltalk.DictionaryTest);
|
|
917
980
|
|
|
918
981
|
smalltalk.addMethod(
|
|
919
|
-
"
|
|
982
|
+
"_testIfAbsent",
|
|
920
983
|
smalltalk.method({
|
|
921
|
-
selector: "
|
|
984
|
+
selector: "testIfAbsent",
|
|
922
985
|
category: 'tests',
|
|
923
986
|
fn: function (){
|
|
924
987
|
var self=this;
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
988
|
+
var d;
|
|
989
|
+
var visited;
|
|
990
|
+
visited=false;
|
|
991
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
992
|
+
smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
|
|
993
|
+
visited=true;
|
|
994
|
+
return visited;
|
|
995
|
+
})]);
|
|
996
|
+
smalltalk.send(self,"_assert_",[visited]);
|
|
997
|
+
return self},
|
|
928
998
|
args: [],
|
|
929
|
-
source: "
|
|
930
|
-
messageSends: ["
|
|
931
|
-
referencedClasses: []
|
|
999
|
+
source: "testIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
|
|
1000
|
+
messageSends: ["new", "at:ifAbsent:", "assert:"],
|
|
1001
|
+
referencedClasses: ["Dictionary"]
|
|
932
1002
|
}),
|
|
933
|
-
smalltalk.
|
|
1003
|
+
smalltalk.DictionaryTest);
|
|
934
1004
|
|
|
935
1005
|
smalltalk.addMethod(
|
|
936
|
-
"
|
|
1006
|
+
"_testIfPresent",
|
|
937
1007
|
smalltalk.method({
|
|
938
|
-
selector: "
|
|
1008
|
+
selector: "testIfPresent",
|
|
939
1009
|
category: 'tests',
|
|
940
1010
|
fn: function (){
|
|
941
1011
|
var self=this;
|
|
942
|
-
|
|
943
|
-
|
|
1012
|
+
var d;
|
|
1013
|
+
var visited;
|
|
1014
|
+
var absent;
|
|
1015
|
+
visited=false;
|
|
1016
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1017
|
+
smalltalk.send(d,"_at_put_",["hello","world"]);
|
|
1018
|
+
smalltalk.send(d,"_at_ifPresent_",["hello",(function(value){
|
|
1019
|
+
visited=value;
|
|
1020
|
+
return visited;
|
|
1021
|
+
})]);
|
|
1022
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
|
|
1023
|
+
absent=smalltalk.send(d,"_at_ifPresent_",["bye",(function(value){
|
|
1024
|
+
visited=value;
|
|
1025
|
+
return visited;
|
|
1026
|
+
})]);
|
|
1027
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(absent,"_isNil",[])]);
|
|
1028
|
+
return self},
|
|
944
1029
|
args: [],
|
|
945
|
-
source: "
|
|
946
|
-
messageSends: ["assert:", "=", "
|
|
947
|
-
referencedClasses: []
|
|
1030
|
+
source: "testIfPresent\x0a\x0a\x09| d visited absent |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ].\x0a\x09self assert: visited = 'world'.\x0a\x0a\x09absent := d at: 'bye' ifPresent: [ :value | visited := value ].\x0a\x09self assert: absent isNil.\x0a",
|
|
1031
|
+
messageSends: ["new", "at:put:", "at:ifPresent:", "assert:", "=", "isNil"],
|
|
1032
|
+
referencedClasses: ["Dictionary"]
|
|
948
1033
|
}),
|
|
949
|
-
smalltalk.
|
|
1034
|
+
smalltalk.DictionaryTest);
|
|
950
1035
|
|
|
951
1036
|
smalltalk.addMethod(
|
|
952
|
-
"
|
|
1037
|
+
"_testIfPresentIfAbsent",
|
|
1038
|
+
smalltalk.method({
|
|
1039
|
+
selector: "testIfPresentIfAbsent",
|
|
1040
|
+
category: 'tests',
|
|
1041
|
+
fn: function (){
|
|
1042
|
+
var self=this;
|
|
1043
|
+
var d;
|
|
1044
|
+
var visited;
|
|
1045
|
+
visited=false;
|
|
1046
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1047
|
+
smalltalk.send(d,"_at_put_",["hello","world"]);
|
|
1048
|
+
smalltalk.send(d,"_at_ifPresent_ifAbsent_",["hello",(function(value){
|
|
1049
|
+
visited=value;
|
|
1050
|
+
return visited;
|
|
1051
|
+
}),(function(){
|
|
1052
|
+
visited=true;
|
|
1053
|
+
return visited;
|
|
1054
|
+
})]);
|
|
1055
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
|
|
1056
|
+
smalltalk.send(d,"_at_ifPresent_ifAbsent_",["buy",(function(value){
|
|
1057
|
+
visited=value;
|
|
1058
|
+
return visited;
|
|
1059
|
+
}),(function(){
|
|
1060
|
+
visited=true;
|
|
1061
|
+
return visited;
|
|
1062
|
+
})]);
|
|
1063
|
+
smalltalk.send(self,"_assert_",[visited]);
|
|
1064
|
+
return self},
|
|
1065
|
+
args: [],
|
|
1066
|
+
source: "testIfPresentIfAbsent\x0a\x0a\x09| d visited |\x0a\x09visited := false.\x0a\x09d := Dictionary new.\x0a\x09d at: 'hello' put: 'world'.\x0a\x0a\x09d at: 'hello' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited = 'world'.\x0a\x0a\x09d at: 'buy' ifPresent: [ :value | visited := value ] ifAbsent: [ visited := true ].\x0a\x09self assert: visited.",
|
|
1067
|
+
messageSends: ["new", "at:put:", "at:ifPresent:ifAbsent:", "assert:", "="],
|
|
1068
|
+
referencedClasses: ["Dictionary"]
|
|
1069
|
+
}),
|
|
1070
|
+
smalltalk.DictionaryTest);
|
|
1071
|
+
|
|
1072
|
+
smalltalk.addMethod(
|
|
1073
|
+
"_testKeys",
|
|
953
1074
|
smalltalk.method({
|
|
954
|
-
selector: "
|
|
1075
|
+
selector: "testKeys",
|
|
955
1076
|
category: 'tests',
|
|
956
1077
|
fn: function (){
|
|
957
1078
|
var self=this;
|
|
958
|
-
var
|
|
959
|
-
|
|
960
|
-
smalltalk.send(
|
|
961
|
-
smalltalk.send(
|
|
962
|
-
smalltalk.send(
|
|
963
|
-
smalltalk.send(self,
|
|
964
|
-
return self
|
|
1079
|
+
var d;
|
|
1080
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1081
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
1082
|
+
smalltalk.send(d,"_at_put_",[(2),(3)]);
|
|
1083
|
+
smalltalk.send(d,"_at_put_",[(3),(4)]);
|
|
1084
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
|
|
1085
|
+
return self},
|
|
965
1086
|
args: [],
|
|
966
|
-
source: "
|
|
967
|
-
messageSends: ["
|
|
968
|
-
referencedClasses: []
|
|
1087
|
+
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)",
|
|
1088
|
+
messageSends: ["new", "at:put:", "assert:", "=", "keys"],
|
|
1089
|
+
referencedClasses: ["Dictionary"]
|
|
969
1090
|
}),
|
|
970
|
-
smalltalk.
|
|
1091
|
+
smalltalk.DictionaryTest);
|
|
971
1092
|
|
|
972
1093
|
smalltalk.addMethod(
|
|
973
|
-
"
|
|
1094
|
+
"_testPrintString",
|
|
974
1095
|
smalltalk.method({
|
|
975
|
-
selector: "
|
|
1096
|
+
selector: "testPrintString",
|
|
976
1097
|
category: 'tests',
|
|
977
1098
|
fn: function (){
|
|
978
1099
|
var self=this;
|
|
979
|
-
|
|
980
|
-
|
|
1100
|
+
var $1,$2;
|
|
1101
|
+
$1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1102
|
+
smalltalk.send($1,"_at_put_",["firstname","James"]);
|
|
1103
|
+
smalltalk.send($1,"_at_put_",["lastname","Bond"]);
|
|
1104
|
+
$2=smalltalk.send($1,"_printString",[]);
|
|
1105
|
+
smalltalk.send(self,"_assert_equals_",["a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2]);
|
|
1106
|
+
return self},
|
|
981
1107
|
args: [],
|
|
982
|
-
source: "
|
|
983
|
-
messageSends: ["assert:equals:", "
|
|
984
|
-
referencedClasses: []
|
|
1108
|
+
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)",
|
|
1109
|
+
messageSends: ["assert:equals:", "at:put:", "new", "printString"],
|
|
1110
|
+
referencedClasses: ["Dictionary"]
|
|
985
1111
|
}),
|
|
986
|
-
smalltalk.
|
|
1112
|
+
smalltalk.DictionaryTest);
|
|
987
1113
|
|
|
988
1114
|
smalltalk.addMethod(
|
|
989
|
-
"
|
|
1115
|
+
"_testRemoveKey",
|
|
990
1116
|
smalltalk.method({
|
|
991
|
-
selector: "
|
|
1117
|
+
selector: "testRemoveKey",
|
|
992
1118
|
category: 'tests',
|
|
993
1119
|
fn: function (){
|
|
994
1120
|
var self=this;
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1121
|
+
var d;
|
|
1122
|
+
var key;
|
|
1123
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1124
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
1125
|
+
smalltalk.send(d,"_at_put_",[(2),(3)]);
|
|
1126
|
+
smalltalk.send(d,"_at_put_",[(3),(4)]);
|
|
1127
|
+
key=(2);
|
|
1128
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
|
|
1129
|
+
smalltalk.send(d,"_removeKey_",[key]);
|
|
1130
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (3)]])]);
|
|
1131
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (4)]])]);
|
|
1132
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(d,"_includesKey_",[(2)])]);
|
|
1133
|
+
return self},
|
|
998
1134
|
args: [],
|
|
999
|
-
source: "
|
|
1000
|
-
messageSends: ["
|
|
1001
|
-
referencedClasses: ["
|
|
1135
|
+
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)",
|
|
1136
|
+
messageSends: ["new", "at:put:", "assert:", "=", "keys", "removeKey:", "values", "deny:", "includesKey:"],
|
|
1137
|
+
referencedClasses: ["Dictionary"]
|
|
1002
1138
|
}),
|
|
1003
|
-
smalltalk.
|
|
1139
|
+
smalltalk.DictionaryTest);
|
|
1004
1140
|
|
|
1005
1141
|
smalltalk.addMethod(
|
|
1006
|
-
"
|
|
1142
|
+
"_testRemoveKeyIfAbsent",
|
|
1007
1143
|
smalltalk.method({
|
|
1008
|
-
selector: "
|
|
1144
|
+
selector: "testRemoveKeyIfAbsent",
|
|
1009
1145
|
category: 'tests',
|
|
1010
1146
|
fn: function (){
|
|
1011
1147
|
var self=this;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
smalltalk.send(
|
|
1015
|
-
|
|
1148
|
+
var d;
|
|
1149
|
+
var key;
|
|
1150
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1151
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
1152
|
+
smalltalk.send(d,"_at_put_",[(2),(3)]);
|
|
1153
|
+
smalltalk.send(d,"_at_put_",[(3),(4)]);
|
|
1154
|
+
key=(2);
|
|
1155
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_",[key]),"__eq",[(3)])]);
|
|
1156
|
+
key=(3);
|
|
1157
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
|
|
1158
|
+
return (42);
|
|
1159
|
+
})]),"__eq",[(4)])]);
|
|
1160
|
+
key="why";
|
|
1161
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
|
|
1162
|
+
return (42);
|
|
1163
|
+
})]),"__eq",[(42)])]);
|
|
1164
|
+
return self},
|
|
1016
1165
|
args: [],
|
|
1017
|
-
source: "
|
|
1018
|
-
messageSends: ["assert:", "=", "
|
|
1019
|
-
referencedClasses: []
|
|
1166
|
+
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.",
|
|
1167
|
+
messageSends: ["new", "at:put:", "assert:", "=", "removeKey:", "removeKey:ifAbsent:"],
|
|
1168
|
+
referencedClasses: ["Dictionary"]
|
|
1020
1169
|
}),
|
|
1021
|
-
smalltalk.
|
|
1022
|
-
|
|
1023
|
-
|
|
1170
|
+
smalltalk.DictionaryTest);
|
|
1024
1171
|
|
|
1025
|
-
smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
|
|
1026
1172
|
smalltalk.addMethod(
|
|
1027
|
-
"
|
|
1173
|
+
"_testSize",
|
|
1028
1174
|
smalltalk.method({
|
|
1029
|
-
selector: "
|
|
1030
|
-
category: '
|
|
1175
|
+
selector: "testSize",
|
|
1176
|
+
category: 'tests',
|
|
1031
1177
|
fn: function (){
|
|
1032
1178
|
var self=this;
|
|
1033
|
-
|
|
1034
|
-
|
|
1179
|
+
var d;
|
|
1180
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1181
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(0)])]);
|
|
1182
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
1183
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(1)])]);
|
|
1184
|
+
smalltalk.send(d,"_at_put_",[(2),(3)]);
|
|
1185
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(2)])]);
|
|
1186
|
+
return self},
|
|
1035
1187
|
args: [],
|
|
1036
|
-
source: "
|
|
1037
|
-
messageSends: [],
|
|
1038
|
-
referencedClasses: []
|
|
1188
|
+
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.",
|
|
1189
|
+
messageSends: ["new", "assert:", "=", "size", "at:put:"],
|
|
1190
|
+
referencedClasses: ["Dictionary"]
|
|
1039
1191
|
}),
|
|
1040
|
-
smalltalk.
|
|
1192
|
+
smalltalk.DictionaryTest);
|
|
1041
1193
|
|
|
1042
1194
|
smalltalk.addMethod(
|
|
1043
|
-
"
|
|
1195
|
+
"_testValues",
|
|
1044
1196
|
smalltalk.method({
|
|
1045
|
-
selector: "
|
|
1046
|
-
category: '
|
|
1047
|
-
fn: function (
|
|
1197
|
+
selector: "testValues",
|
|
1198
|
+
category: 'tests',
|
|
1199
|
+
fn: function (){
|
|
1048
1200
|
var self=this;
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1201
|
+
var d;
|
|
1202
|
+
d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
|
|
1203
|
+
smalltalk.send(d,"_at_put_",[(1),(2)]);
|
|
1204
|
+
smalltalk.send(d,"_at_put_",[(2),(3)]);
|
|
1205
|
+
smalltalk.send(d,"_at_put_",[(3),(4)]);
|
|
1206
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (3), (4)]])]);
|
|
1207
|
+
return self},
|
|
1208
|
+
args: [],
|
|
1209
|
+
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)",
|
|
1210
|
+
messageSends: ["new", "at:put:", "assert:", "=", "values"],
|
|
1211
|
+
referencedClasses: ["Dictionary"]
|
|
1055
1212
|
}),
|
|
1056
|
-
smalltalk.
|
|
1057
|
-
|
|
1213
|
+
smalltalk.DictionaryTest);
|
|
1058
1214
|
|
|
1059
1215
|
|
|
1060
|
-
smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1061
1216
|
smalltalk.addMethod(
|
|
1062
|
-
"
|
|
1217
|
+
"_collectionClass",
|
|
1063
1218
|
smalltalk.method({
|
|
1064
|
-
selector: "
|
|
1065
|
-
category: '
|
|
1219
|
+
selector: "collectionClass",
|
|
1220
|
+
category: 'accessing',
|
|
1066
1221
|
fn: function (){
|
|
1067
1222
|
var self=this;
|
|
1068
|
-
|
|
1069
|
-
|
|
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]);
|
|
1073
|
-
return self;},
|
|
1223
|
+
return (smalltalk.Dictionary || Dictionary);
|
|
1224
|
+
},
|
|
1074
1225
|
args: [],
|
|
1075
|
-
source: "
|
|
1076
|
-
messageSends: [
|
|
1077
|
-
referencedClasses: ["
|
|
1226
|
+
source: "collectionClass\x0a\x09^ Dictionary",
|
|
1227
|
+
messageSends: [],
|
|
1228
|
+
referencedClasses: ["Dictionary"]
|
|
1078
1229
|
}),
|
|
1079
|
-
smalltalk.
|
|
1230
|
+
smalltalk.DictionaryTest.klass);
|
|
1080
1231
|
|
|
1232
|
+
|
|
1233
|
+
smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
|
|
1081
1234
|
smalltalk.addMethod(
|
|
1082
|
-
"
|
|
1235
|
+
"_testAt",
|
|
1083
1236
|
smalltalk.method({
|
|
1084
|
-
selector: "
|
|
1237
|
+
selector: "testAt",
|
|
1085
1238
|
category: 'tests',
|
|
1086
1239
|
fn: function (){
|
|
1087
1240
|
var self=this;
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
smalltalk.send(
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
|
|
1094
|
-
return self;},
|
|
1241
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(4)]),"__eq",[(-4)])]);
|
|
1242
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1243
|
+
return smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(5)]);
|
|
1244
|
+
}),(smalltalk.Error || Error)]);
|
|
1245
|
+
return self},
|
|
1095
1246
|
args: [],
|
|
1096
|
-
source: "
|
|
1097
|
-
messageSends: ["
|
|
1098
|
-
referencedClasses: ["
|
|
1247
|
+
source: "testAt\x0a\x09self assert: (self collection at: 4) = -4.\x0a\x09self should: [ self collection at: 5 ] raise: Error",
|
|
1248
|
+
messageSends: ["assert:", "=", "at:", "collection", "should:raise:"],
|
|
1249
|
+
referencedClasses: ["Error"]
|
|
1099
1250
|
}),
|
|
1100
|
-
smalltalk.
|
|
1251
|
+
smalltalk.SequenceableCollectionTest);
|
|
1101
1252
|
|
|
1102
1253
|
smalltalk.addMethod(
|
|
1103
|
-
"
|
|
1254
|
+
"_testAtIfAbsent",
|
|
1104
1255
|
smalltalk.method({
|
|
1105
|
-
selector: "
|
|
1256
|
+
selector: "testAtIfAbsent",
|
|
1106
1257
|
category: 'tests',
|
|
1107
1258
|
fn: function (){
|
|
1108
1259
|
var self=this;
|
|
1109
|
-
smalltalk.send(self,
|
|
1110
|
-
return
|
|
1260
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_ifAbsent_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__plus",[(1)]),(function(){
|
|
1261
|
+
return "none";
|
|
1262
|
+
})]),"__eq",["none"])]);
|
|
1263
|
+
return self},
|
|
1111
1264
|
args: [],
|
|
1112
|
-
source: "
|
|
1113
|
-
messageSends: ["
|
|
1114
|
-
referencedClasses: [
|
|
1265
|
+
source: "testAtIfAbsent\x0a\x09self assert: (self collection at: (self collection size + 1) ifAbsent: [ 'none' ]) = 'none'",
|
|
1266
|
+
messageSends: ["assert:", "=", "at:ifAbsent:", "+", "size", "collection"],
|
|
1267
|
+
referencedClasses: []
|
|
1115
1268
|
}),
|
|
1116
|
-
smalltalk.
|
|
1269
|
+
smalltalk.SequenceableCollectionTest);
|
|
1270
|
+
|
|
1117
1271
|
|
|
1272
|
+
|
|
1273
|
+
smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
|
|
1118
1274
|
smalltalk.addMethod(
|
|
1119
|
-
"
|
|
1275
|
+
"_testAtIfAbsent",
|
|
1120
1276
|
smalltalk.method({
|
|
1121
|
-
selector: "
|
|
1122
|
-
category: '
|
|
1277
|
+
selector: "testAtIfAbsent",
|
|
1278
|
+
category: 'testing',
|
|
1123
1279
|
fn: function (){
|
|
1124
1280
|
var self=this;
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
smalltalk.send(self,
|
|
1128
|
-
smalltalk.send(self,
|
|
1129
|
-
smalltalk.send(self,
|
|
1130
|
-
|
|
1131
|
-
|
|
1281
|
+
var array;
|
|
1282
|
+
array=["hello", "world"];
|
|
1283
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(1)]),"hello"]);
|
|
1284
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(2)]),"world"]);
|
|
1285
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(2),(function(){
|
|
1286
|
+
return "not found";
|
|
1287
|
+
})]),"world"]);
|
|
1288
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(0),(function(){
|
|
1289
|
+
return "not found";
|
|
1290
|
+
})]),"not found"]);
|
|
1291
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(-10),(function(){
|
|
1292
|
+
return "not found";
|
|
1293
|
+
})]),"not found"]);
|
|
1294
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(3),(function(){
|
|
1295
|
+
return "not found";
|
|
1296
|
+
})]),"not found"]);
|
|
1297
|
+
return self},
|
|
1132
1298
|
args: [],
|
|
1133
|
-
source: "
|
|
1134
|
-
messageSends: ["
|
|
1135
|
-
referencedClasses: [
|
|
1299
|
+
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'.",
|
|
1300
|
+
messageSends: ["assert:equals:", "at:", "at:ifAbsent:"],
|
|
1301
|
+
referencedClasses: []
|
|
1136
1302
|
}),
|
|
1137
|
-
smalltalk.
|
|
1303
|
+
smalltalk.ArrayTest);
|
|
1138
1304
|
|
|
1139
1305
|
smalltalk.addMethod(
|
|
1140
|
-
"
|
|
1306
|
+
"_testFirstN",
|
|
1141
1307
|
smalltalk.method({
|
|
1142
|
-
selector: "
|
|
1143
|
-
category: '
|
|
1308
|
+
selector: "testFirstN",
|
|
1309
|
+
category: 'testing',
|
|
1144
1310
|
fn: function (){
|
|
1145
1311
|
var self=this;
|
|
1146
|
-
smalltalk.send(self,
|
|
1147
|
-
return self
|
|
1312
|
+
smalltalk.send(self,"_assert_equals_",[[(1),(2),(3)],smalltalk.send([(1),(2),(3),(4),(5)],"_first_",[(3)])]);
|
|
1313
|
+
return self},
|
|
1148
1314
|
args: [],
|
|
1149
|
-
source: "
|
|
1150
|
-
messageSends: ["
|
|
1151
|
-
referencedClasses: [
|
|
1315
|
+
source: "testFirstN\x0a\x09self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).",
|
|
1316
|
+
messageSends: ["assert:equals:", "first:"],
|
|
1317
|
+
referencedClasses: []
|
|
1152
1318
|
}),
|
|
1153
|
-
smalltalk.
|
|
1319
|
+
smalltalk.ArrayTest);
|
|
1154
1320
|
|
|
1155
1321
|
smalltalk.addMethod(
|
|
1156
|
-
"
|
|
1322
|
+
"_testIfEmpty",
|
|
1157
1323
|
smalltalk.method({
|
|
1158
|
-
selector: "
|
|
1159
|
-
category: '
|
|
1324
|
+
selector: "testIfEmpty",
|
|
1325
|
+
category: 'testing',
|
|
1160
1326
|
fn: function (){
|
|
1161
1327
|
var self=this;
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
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", [])])]);
|
|
1168
|
-
return self;},
|
|
1328
|
+
smalltalk.send(self,"_assert_equals_",["zork",smalltalk.send("","_ifEmpty_",[(function(){
|
|
1329
|
+
return "zork";
|
|
1330
|
+
})])]);
|
|
1331
|
+
return self},
|
|
1169
1332
|
args: [],
|
|
1170
|
-
source: "
|
|
1171
|
-
messageSends: ["
|
|
1172
|
-
referencedClasses: [
|
|
1333
|
+
source: "testIfEmpty\x0a\x09self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )",
|
|
1334
|
+
messageSends: ["assert:equals:", "ifEmpty:"],
|
|
1335
|
+
referencedClasses: []
|
|
1173
1336
|
}),
|
|
1174
|
-
smalltalk.
|
|
1337
|
+
smalltalk.ArrayTest);
|
|
1175
1338
|
|
|
1176
1339
|
smalltalk.addMethod(
|
|
1177
|
-
"
|
|
1340
|
+
"_testPrintString",
|
|
1178
1341
|
smalltalk.method({
|
|
1179
|
-
selector: "
|
|
1180
|
-
category: '
|
|
1342
|
+
selector: "testPrintString",
|
|
1343
|
+
category: 'testing',
|
|
1181
1344
|
fn: function (){
|
|
1182
1345
|
var self=this;
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
smalltalk.send(self,
|
|
1187
|
-
smalltalk.send(
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1346
|
+
var $1,$2;
|
|
1347
|
+
var array;
|
|
1348
|
+
array=smalltalk.send((smalltalk.Array || Array),"_new",[]);
|
|
1349
|
+
smalltalk.send(self,"_assert_equals_",["a Array ()",smalltalk.send(array,"_printString",[])]);
|
|
1350
|
+
smalltalk.send(array,"_add_",[(1)]);
|
|
1351
|
+
$1=smalltalk.send(array,"_add_",[(3)]);
|
|
1352
|
+
smalltalk.send(self,"_assert_equals_",["a Array (1 3)",smalltalk.send(array,"_printString",[])]);
|
|
1353
|
+
smalltalk.send(array,"_add_",["foo"]);
|
|
1354
|
+
smalltalk.send(self,"_assert_equals_",["a Array (1 3 'foo')",smalltalk.send(array,"_printString",[])]);
|
|
1355
|
+
smalltalk.send(array,"_remove_",[(1)]);
|
|
1356
|
+
$2=smalltalk.send(array,"_remove_",[(3)]);
|
|
1357
|
+
smalltalk.send(self,"_assert_equals_",["a Array ('foo')",smalltalk.send(array,"_printString",[])]);
|
|
1358
|
+
smalltalk.send(array,"_addLast_",[(3)]);
|
|
1359
|
+
smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3)",smalltalk.send(array,"_printString",[])]);
|
|
1360
|
+
smalltalk.send(array,"_addLast_",[(3)]);
|
|
1361
|
+
smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3 3)",smalltalk.send(array,"_printString",[])]);
|
|
1362
|
+
return self},
|
|
1363
|
+
args: [],
|
|
1364
|
+
source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: 'a Array ()' equals: ( array printString ).\x0a\x09array add: 1; add: 3.\x0a\x09self assert: 'a Array (1 3)' equals: ( array printString ).\x0a\x09array add: 'foo'.\x0a\x09self assert: 'a Array (1 3 ''foo'')' equals: ( array printString ).\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: 'a Array (''foo'')' equals: ( array printString ).\x0a\x09array addLast: 3.\x0a\x09self assert: 'a Array (''foo'' 3)' equals: ( array printString ).\x0a\x09array addLast: 3.\x0a\x09self assert: 'a Array (''foo'' 3 3)' equals: ( array printString ).",
|
|
1365
|
+
messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
|
|
1366
|
+
referencedClasses: ["Array"]
|
|
1193
1367
|
}),
|
|
1194
|
-
smalltalk.
|
|
1368
|
+
smalltalk.ArrayTest);
|
|
1369
|
+
|
|
1195
1370
|
|
|
1196
1371
|
smalltalk.addMethod(
|
|
1197
|
-
"
|
|
1372
|
+
"_collectionClass",
|
|
1198
1373
|
smalltalk.method({
|
|
1199
|
-
selector: "
|
|
1200
|
-
category: '
|
|
1374
|
+
selector: "collectionClass",
|
|
1375
|
+
category: 'accessing',
|
|
1201
1376
|
fn: function (){
|
|
1202
1377
|
var self=this;
|
|
1203
|
-
|
|
1204
|
-
|
|
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)]);
|
|
1209
|
-
return self;},
|
|
1378
|
+
return (smalltalk.Array || Array);
|
|
1379
|
+
},
|
|
1210
1380
|
args: [],
|
|
1211
|
-
source: "
|
|
1212
|
-
messageSends: [
|
|
1213
|
-
referencedClasses: ["
|
|
1381
|
+
source: "collectionClass\x0a\x09^ Array",
|
|
1382
|
+
messageSends: [],
|
|
1383
|
+
referencedClasses: ["Array"]
|
|
1214
1384
|
}),
|
|
1215
|
-
smalltalk.
|
|
1385
|
+
smalltalk.ArrayTest.klass);
|
|
1386
|
+
|
|
1216
1387
|
|
|
1388
|
+
smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
|
|
1217
1389
|
smalltalk.addMethod(
|
|
1218
|
-
"
|
|
1390
|
+
"_collection",
|
|
1219
1391
|
smalltalk.method({
|
|
1220
|
-
selector: "
|
|
1221
|
-
category: '
|
|
1392
|
+
selector: "collection",
|
|
1393
|
+
category: 'accessing',
|
|
1222
1394
|
fn: function (){
|
|
1223
1395
|
var self=this;
|
|
1224
|
-
|
|
1225
|
-
|
|
1396
|
+
return "hello";
|
|
1397
|
+
},
|
|
1226
1398
|
args: [],
|
|
1227
|
-
source: "
|
|
1228
|
-
messageSends: [
|
|
1399
|
+
source: "collection\x0a\x09^'hello'",
|
|
1400
|
+
messageSends: [],
|
|
1229
1401
|
referencedClasses: []
|
|
1230
1402
|
}),
|
|
1231
|
-
smalltalk.
|
|
1403
|
+
smalltalk.StringTest);
|
|
1232
1404
|
|
|
1233
1405
|
smalltalk.addMethod(
|
|
1234
|
-
"
|
|
1406
|
+
"_collectionWithDuplicates",
|
|
1235
1407
|
smalltalk.method({
|
|
1236
|
-
selector: "
|
|
1237
|
-
category: '
|
|
1408
|
+
selector: "collectionWithDuplicates",
|
|
1409
|
+
category: 'accessing',
|
|
1238
1410
|
fn: function (){
|
|
1239
1411
|
var self=this;
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
|
|
1243
|
-
return self;},
|
|
1412
|
+
return "abbaerte";
|
|
1413
|
+
},
|
|
1244
1414
|
args: [],
|
|
1245
|
-
source: "
|
|
1246
|
-
messageSends: [
|
|
1247
|
-
referencedClasses: [
|
|
1415
|
+
source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
|
|
1416
|
+
messageSends: [],
|
|
1417
|
+
referencedClasses: []
|
|
1248
1418
|
}),
|
|
1249
|
-
smalltalk.
|
|
1419
|
+
smalltalk.StringTest);
|
|
1250
1420
|
|
|
1251
1421
|
smalltalk.addMethod(
|
|
1252
|
-
"
|
|
1422
|
+
"_testAddRemove",
|
|
1253
1423
|
smalltalk.method({
|
|
1254
|
-
selector: "
|
|
1424
|
+
selector: "testAddRemove",
|
|
1255
1425
|
category: 'tests',
|
|
1256
1426
|
fn: function (){
|
|
1257
1427
|
var self=this;
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
(
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
return self
|
|
1428
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1429
|
+
return smalltalk.send("hello","_add_",["a"]);
|
|
1430
|
+
}),(smalltalk.Error || Error)]);
|
|
1431
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1432
|
+
return smalltalk.send("hello","_remove_",["h"]);
|
|
1433
|
+
}),(smalltalk.Error || Error)]);
|
|
1434
|
+
return self},
|
|
1265
1435
|
args: [],
|
|
1266
|
-
source: "
|
|
1267
|
-
messageSends: ["
|
|
1268
|
-
referencedClasses: ["
|
|
1436
|
+
source: "testAddRemove\x0a\x09self should: ['hello' add: 'a'] raise: Error.\x0a\x09self should: ['hello' remove: 'h'] raise: Error",
|
|
1437
|
+
messageSends: ["should:raise:", "add:", "remove:"],
|
|
1438
|
+
referencedClasses: ["Error"]
|
|
1269
1439
|
}),
|
|
1270
|
-
smalltalk.
|
|
1271
|
-
|
|
1272
|
-
|
|
1440
|
+
smalltalk.StringTest);
|
|
1273
1441
|
|
|
1274
|
-
smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
|
|
1275
1442
|
smalltalk.addMethod(
|
|
1276
|
-
"
|
|
1443
|
+
"_testAsArray",
|
|
1277
1444
|
smalltalk.method({
|
|
1278
|
-
selector: "
|
|
1279
|
-
category: '
|
|
1445
|
+
selector: "testAsArray",
|
|
1446
|
+
category: 'tests',
|
|
1280
1447
|
fn: function (){
|
|
1281
1448
|
var self=this;
|
|
1282
|
-
(self[
|
|
1283
|
-
|
|
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", [])));
|
|
1287
|
-
return self;},
|
|
1449
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_asArray",[]),"__eq",[["h", "e", "l", "l", "o"]])]);
|
|
1450
|
+
return self},
|
|
1288
1451
|
args: [],
|
|
1289
|
-
source: "
|
|
1290
|
-
messageSends: ["
|
|
1291
|
-
referencedClasses: [
|
|
1452
|
+
source: "testAsArray\x0a\x09self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').",
|
|
1453
|
+
messageSends: ["assert:", "=", "asArray"],
|
|
1454
|
+
referencedClasses: []
|
|
1292
1455
|
}),
|
|
1293
|
-
smalltalk.
|
|
1456
|
+
smalltalk.StringTest);
|
|
1294
1457
|
|
|
1295
1458
|
smalltalk.addMethod(
|
|
1296
|
-
"
|
|
1459
|
+
"_testAt",
|
|
1297
1460
|
smalltalk.method({
|
|
1298
|
-
selector: "
|
|
1299
|
-
category: '
|
|
1461
|
+
selector: "testAt",
|
|
1462
|
+
category: 'tests',
|
|
1300
1463
|
fn: function (){
|
|
1301
1464
|
var self=this;
|
|
1302
|
-
|
|
1303
|
-
|
|
1465
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(1)]),"__eq",["h"])]);
|
|
1466
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(5)]),"__eq",["o"])]);
|
|
1467
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_ifAbsent_",[(6),(function(){
|
|
1468
|
+
return nil;
|
|
1469
|
+
})]),"__eq",[nil])]);
|
|
1470
|
+
return self},
|
|
1304
1471
|
args: [],
|
|
1305
|
-
source: "
|
|
1306
|
-
messageSends: ["
|
|
1307
|
-
referencedClasses: [
|
|
1472
|
+
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",
|
|
1473
|
+
messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
|
|
1474
|
+
referencedClasses: []
|
|
1308
1475
|
}),
|
|
1309
|
-
smalltalk.
|
|
1476
|
+
smalltalk.StringTest);
|
|
1310
1477
|
|
|
1311
1478
|
smalltalk.addMethod(
|
|
1312
|
-
"
|
|
1479
|
+
"_testAtPut",
|
|
1313
1480
|
smalltalk.method({
|
|
1314
|
-
selector: "
|
|
1481
|
+
selector: "testAtPut",
|
|
1315
1482
|
category: 'tests',
|
|
1316
1483
|
fn: function (){
|
|
1317
1484
|
var self=this;
|
|
1318
|
-
smalltalk.send(self,
|
|
1319
|
-
return
|
|
1485
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1486
|
+
return smalltalk.send("hello","_at_put_",[(1),"a"]);
|
|
1487
|
+
}),(smalltalk.Error || Error)]);
|
|
1488
|
+
return self},
|
|
1320
1489
|
args: [],
|
|
1321
|
-
source: "
|
|
1322
|
-
messageSends: ["
|
|
1323
|
-
referencedClasses: []
|
|
1490
|
+
source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
|
|
1491
|
+
messageSends: ["should:raise:", "at:put:"],
|
|
1492
|
+
referencedClasses: ["Error"]
|
|
1324
1493
|
}),
|
|
1325
|
-
smalltalk.
|
|
1494
|
+
smalltalk.StringTest);
|
|
1326
1495
|
|
|
1327
1496
|
smalltalk.addMethod(
|
|
1328
|
-
"
|
|
1497
|
+
"_testCollect",
|
|
1329
1498
|
smalltalk.method({
|
|
1330
|
-
selector: "
|
|
1499
|
+
selector: "testCollect",
|
|
1331
1500
|
category: 'tests',
|
|
1332
1501
|
fn: function (){
|
|
1333
1502
|
var self=this;
|
|
1334
|
-
|
|
1335
|
-
|
|
1503
|
+
var newCollection;
|
|
1504
|
+
newCollection="hheelllloo";
|
|
1505
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
|
|
1506
|
+
return smalltalk.send(each,"__comma",[each]);
|
|
1507
|
+
})]),newCollection]);
|
|
1508
|
+
return self},
|
|
1336
1509
|
args: [],
|
|
1337
|
-
source: "
|
|
1338
|
-
messageSends: ["
|
|
1510
|
+
source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
|
|
1511
|
+
messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
|
|
1339
1512
|
referencedClasses: []
|
|
1340
1513
|
}),
|
|
1341
|
-
smalltalk.
|
|
1514
|
+
smalltalk.StringTest);
|
|
1342
1515
|
|
|
1343
1516
|
smalltalk.addMethod(
|
|
1344
|
-
"
|
|
1517
|
+
"_testCopyWithoutAll",
|
|
1345
1518
|
smalltalk.method({
|
|
1346
|
-
selector: "
|
|
1519
|
+
selector: "testCopyWithoutAll",
|
|
1347
1520
|
category: 'tests',
|
|
1348
1521
|
fn: function (){
|
|
1349
1522
|
var self=this;
|
|
1350
|
-
smalltalk.send(self,
|
|
1351
|
-
return self
|
|
1523
|
+
smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send("*hello* *world*","_copyWithoutAll_",["*"])]);
|
|
1524
|
+
return self},
|
|
1352
1525
|
args: [],
|
|
1353
|
-
source: "
|
|
1354
|
-
messageSends: ["assert:equals:", "
|
|
1526
|
+
source: "testCopyWithoutAll\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: ('*hello* *world*' copyWithoutAll: '*')",
|
|
1527
|
+
messageSends: ["assert:equals:", "copyWithoutAll:"],
|
|
1355
1528
|
referencedClasses: []
|
|
1356
1529
|
}),
|
|
1357
|
-
smalltalk.
|
|
1530
|
+
smalltalk.StringTest);
|
|
1358
1531
|
|
|
1359
1532
|
smalltalk.addMethod(
|
|
1360
|
-
"
|
|
1533
|
+
"_testDetect",
|
|
1361
1534
|
smalltalk.method({
|
|
1362
|
-
selector: "
|
|
1535
|
+
selector: "testDetect",
|
|
1363
1536
|
category: 'tests',
|
|
1364
1537
|
fn: function (){
|
|
1365
1538
|
var self=this;
|
|
1366
|
-
smalltalk.send(self,
|
|
1367
|
-
return
|
|
1539
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
1540
|
+
return smalltalk.send(each,"__eq",["h"]);
|
|
1541
|
+
})]),"__eq",["h"])]);
|
|
1542
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1543
|
+
return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
1544
|
+
return smalltalk.send(each,"__eq",[(6)]);
|
|
1545
|
+
})]);
|
|
1546
|
+
}),(smalltalk.Error || Error)]);
|
|
1547
|
+
return self},
|
|
1368
1548
|
args: [],
|
|
1369
|
-
source: "
|
|
1370
|
-
messageSends: ["assert:
|
|
1371
|
-
referencedClasses: []
|
|
1549
|
+
source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) = 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
|
|
1550
|
+
messageSends: ["assert:", "=", "detect:", "collection", "should:raise:"],
|
|
1551
|
+
referencedClasses: ["Error"]
|
|
1372
1552
|
}),
|
|
1373
|
-
smalltalk.
|
|
1374
|
-
|
|
1553
|
+
smalltalk.StringTest);
|
|
1375
1554
|
|
|
1555
|
+
smalltalk.addMethod(
|
|
1556
|
+
"_testEquality",
|
|
1557
|
+
smalltalk.method({
|
|
1558
|
+
selector: "testEquality",
|
|
1559
|
+
category: 'tests',
|
|
1560
|
+
fn: function (){
|
|
1561
|
+
var self=this;
|
|
1562
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",["hello"])]);
|
|
1563
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",["world"])]);
|
|
1564
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",[smalltalk.send("hello","_yourself",[])])]);
|
|
1565
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq",["hello"])]);
|
|
1566
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
|
|
1567
|
+
return self},
|
|
1568
|
+
args: [],
|
|
1569
|
+
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",
|
|
1570
|
+
messageSends: ["assert:", "=", "deny:", "yourself"],
|
|
1571
|
+
referencedClasses: []
|
|
1572
|
+
}),
|
|
1573
|
+
smalltalk.StringTest);
|
|
1376
1574
|
|
|
1377
|
-
smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
|
|
1378
1575
|
smalltalk.addMethod(
|
|
1379
|
-
"
|
|
1576
|
+
"_testIdentity",
|
|
1380
1577
|
smalltalk.method({
|
|
1381
|
-
selector: "
|
|
1382
|
-
category: '
|
|
1578
|
+
selector: "testIdentity",
|
|
1579
|
+
category: 'tests',
|
|
1383
1580
|
fn: function (){
|
|
1384
1581
|
var self=this;
|
|
1385
|
-
smalltalk.send(self,
|
|
1386
|
-
|
|
1387
|
-
|
|
1582
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",["hello"])]);
|
|
1583
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq_eq",["world"])]);
|
|
1584
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",[smalltalk.send("hello","_yourself",[])])]);
|
|
1585
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq_eq",["hello"])]);
|
|
1586
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[(0)])]);
|
|
1587
|
+
return self},
|
|
1388
1588
|
args: [],
|
|
1389
|
-
source: "
|
|
1390
|
-
messageSends: ["
|
|
1391
|
-
referencedClasses: [
|
|
1589
|
+
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",
|
|
1590
|
+
messageSends: ["assert:", "==", "deny:", "yourself"],
|
|
1591
|
+
referencedClasses: []
|
|
1392
1592
|
}),
|
|
1393
|
-
smalltalk.
|
|
1593
|
+
smalltalk.StringTest);
|
|
1394
1594
|
|
|
1395
1595
|
smalltalk.addMethod(
|
|
1396
|
-
"
|
|
1596
|
+
"_testIncludesSubString",
|
|
1397
1597
|
smalltalk.method({
|
|
1398
|
-
selector: "
|
|
1598
|
+
selector: "testIncludesSubString",
|
|
1399
1599
|
category: 'tests',
|
|
1400
1600
|
fn: function (){
|
|
1401
1601
|
var self=this;
|
|
1402
|
-
smalltalk.send(self,
|
|
1403
|
-
|
|
1602
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("amber","_includesSubString_",["ber"])]);
|
|
1603
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("amber","_includesSubString_",["zork"])]);
|
|
1604
|
+
return self},
|
|
1404
1605
|
args: [],
|
|
1405
|
-
source: "
|
|
1406
|
-
messageSends: ["assert:
|
|
1606
|
+
source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
|
|
1607
|
+
messageSends: ["assert:", "includesSubString:", "deny:"],
|
|
1407
1608
|
referencedClasses: []
|
|
1408
1609
|
}),
|
|
1409
|
-
smalltalk.
|
|
1610
|
+
smalltalk.StringTest);
|
|
1410
1611
|
|
|
1411
1612
|
smalltalk.addMethod(
|
|
1412
|
-
"
|
|
1613
|
+
"_testJoin",
|
|
1413
1614
|
smalltalk.method({
|
|
1414
|
-
selector: "
|
|
1615
|
+
selector: "testJoin",
|
|
1415
1616
|
category: 'tests',
|
|
1416
1617
|
fn: function (){
|
|
1417
1618
|
var self=this;
|
|
1418
|
-
smalltalk.send(self,
|
|
1419
|
-
return self
|
|
1619
|
+
smalltalk.send(self,"_assert_equals_",["hello,world",smalltalk.send(",","_join_",[["hello", "world"]])]);
|
|
1620
|
+
return self},
|
|
1420
1621
|
args: [],
|
|
1421
|
-
source: "
|
|
1422
|
-
messageSends: ["assert:equals:", "
|
|
1622
|
+
source: "testJoin\x0a\x09self assert: 'hello,world' equals: (',' join: #('hello' 'world'))",
|
|
1623
|
+
messageSends: ["assert:equals:", "join:"],
|
|
1423
1624
|
referencedClasses: []
|
|
1424
1625
|
}),
|
|
1425
|
-
smalltalk.
|
|
1626
|
+
smalltalk.StringTest);
|
|
1426
1627
|
|
|
1427
1628
|
smalltalk.addMethod(
|
|
1428
|
-
"
|
|
1629
|
+
"_testSelect",
|
|
1429
1630
|
smalltalk.method({
|
|
1430
|
-
selector: "
|
|
1631
|
+
selector: "testSelect",
|
|
1431
1632
|
category: 'tests',
|
|
1432
1633
|
fn: function (){
|
|
1433
1634
|
var self=this;
|
|
1434
|
-
|
|
1435
|
-
|
|
1635
|
+
var newCollection;
|
|
1636
|
+
newCollection="o";
|
|
1637
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
|
|
1638
|
+
return smalltalk.send(each,"__eq",["o"]);
|
|
1639
|
+
})]),newCollection]);
|
|
1640
|
+
return self},
|
|
1436
1641
|
args: [],
|
|
1437
|
-
source: "
|
|
1438
|
-
messageSends: ["
|
|
1642
|
+
source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
|
|
1643
|
+
messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
|
|
1439
1644
|
referencedClasses: []
|
|
1440
1645
|
}),
|
|
1441
|
-
smalltalk.
|
|
1646
|
+
smalltalk.StringTest);
|
|
1442
1647
|
|
|
1443
1648
|
smalltalk.addMethod(
|
|
1444
|
-
"
|
|
1649
|
+
"_testSize",
|
|
1445
1650
|
smalltalk.method({
|
|
1446
|
-
selector: "
|
|
1651
|
+
selector: "testSize",
|
|
1447
1652
|
category: 'tests',
|
|
1448
1653
|
fn: function (){
|
|
1449
1654
|
var self=this;
|
|
1450
|
-
smalltalk.send(self,
|
|
1451
|
-
|
|
1655
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send("smalltalk","_size",[]),(9)]);
|
|
1656
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send("","_size",[]),(0)]);
|
|
1657
|
+
return self},
|
|
1452
1658
|
args: [],
|
|
1453
|
-
source: "
|
|
1454
|
-
messageSends: ["assert:equals:", "
|
|
1659
|
+
source: "testSize\x0a\x09self assert: 'smalltalk' size equals: 9.\x0a\x09self assert: '' size equals: 0",
|
|
1660
|
+
messageSends: ["assert:equals:", "size"],
|
|
1455
1661
|
referencedClasses: []
|
|
1456
1662
|
}),
|
|
1457
|
-
smalltalk.
|
|
1663
|
+
smalltalk.StringTest);
|
|
1664
|
+
|
|
1665
|
+
smalltalk.addMethod(
|
|
1666
|
+
"_testStreamContents",
|
|
1667
|
+
smalltalk.method({
|
|
1668
|
+
selector: "testStreamContents",
|
|
1669
|
+
category: 'tests',
|
|
1670
|
+
fn: function (){
|
|
1671
|
+
var self=this;
|
|
1672
|
+
var $1;
|
|
1673
|
+
smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
|
|
1674
|
+
smalltalk.send(aStream,"_nextPutAll_",["hello"]);
|
|
1675
|
+
smalltalk.send(aStream,"_space",[]);
|
|
1676
|
+
$1=smalltalk.send(aStream,"_nextPutAll_",["world"]);
|
|
1677
|
+
return $1;
|
|
1678
|
+
})])]);
|
|
1679
|
+
return self},
|
|
1680
|
+
args: [],
|
|
1681
|
+
source: "testStreamContents\x0a\x09self \x0a\x09\x09assert: 'hello world' \x0a\x09\x09equals: (String streamContents: [ :aStream | \x0a\x09\x09\x09aStream \x0a\x09\x09\x09\x09nextPutAll: 'hello'; space; \x0a\x09\x09\x09\x09nextPutAll: 'world' ])",
|
|
1682
|
+
messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
|
|
1683
|
+
referencedClasses: ["String"]
|
|
1684
|
+
}),
|
|
1685
|
+
smalltalk.StringTest);
|
|
1458
1686
|
|
|
1459
1687
|
|
|
1460
1688
|
smalltalk.addMethod(
|
|
1461
|
-
"
|
|
1689
|
+
"_collectionClass",
|
|
1462
1690
|
smalltalk.method({
|
|
1463
|
-
selector: "
|
|
1691
|
+
selector: "collectionClass",
|
|
1464
1692
|
category: 'accessing',
|
|
1465
1693
|
fn: function (){
|
|
1466
1694
|
var self=this;
|
|
1467
|
-
return
|
|
1468
|
-
|
|
1695
|
+
return (smalltalk.String || String);
|
|
1696
|
+
},
|
|
1469
1697
|
args: [],
|
|
1470
|
-
source: "
|
|
1698
|
+
source: "collectionClass\x0a\x09^ String",
|
|
1471
1699
|
messageSends: [],
|
|
1472
|
-
referencedClasses: []
|
|
1700
|
+
referencedClasses: ["String"]
|
|
1473
1701
|
}),
|
|
1474
|
-
smalltalk.
|
|
1702
|
+
smalltalk.StringTest.klass);
|
|
1475
1703
|
|
|
1476
1704
|
|
|
1477
|
-
smalltalk.addClass('
|
|
1705
|
+
smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
|
|
1478
1706
|
smalltalk.addMethod(
|
|
1479
|
-
"
|
|
1707
|
+
"_collection",
|
|
1480
1708
|
smalltalk.method({
|
|
1481
|
-
selector: "
|
|
1482
|
-
category: '
|
|
1709
|
+
selector: "collection",
|
|
1710
|
+
category: 'accessing',
|
|
1483
1711
|
fn: function (){
|
|
1484
1712
|
var self=this;
|
|
1485
|
-
|
|
1486
|
-
|
|
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)]);
|
|
1489
|
-
return self;},
|
|
1713
|
+
return smalltalk.symbolFor("hello");
|
|
1714
|
+
},
|
|
1490
1715
|
args: [],
|
|
1491
|
-
source: "
|
|
1492
|
-
messageSends: [
|
|
1493
|
-
referencedClasses: [
|
|
1716
|
+
source: "collection\x0a\x09^ #hello",
|
|
1717
|
+
messageSends: [],
|
|
1718
|
+
referencedClasses: []
|
|
1494
1719
|
}),
|
|
1495
|
-
smalltalk.
|
|
1720
|
+
smalltalk.SymbolTest);
|
|
1496
1721
|
|
|
1497
1722
|
smalltalk.addMethod(
|
|
1498
|
-
"
|
|
1723
|
+
"_collectionWithDuplicates",
|
|
1499
1724
|
smalltalk.method({
|
|
1500
|
-
selector: "
|
|
1501
|
-
category: '
|
|
1725
|
+
selector: "collectionWithDuplicates",
|
|
1726
|
+
category: 'accessing',
|
|
1502
1727
|
fn: function (){
|
|
1503
1728
|
var self=this;
|
|
1504
|
-
|
|
1505
|
-
|
|
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)])]);
|
|
1508
|
-
return self;},
|
|
1729
|
+
return smalltalk.symbolFor("phhaaarorra");
|
|
1730
|
+
},
|
|
1509
1731
|
args: [],
|
|
1510
|
-
source: "
|
|
1511
|
-
messageSends: [
|
|
1512
|
-
referencedClasses: [
|
|
1732
|
+
source: "collectionWithDuplicates\x0a\x09^ #phhaaarorra",
|
|
1733
|
+
messageSends: [],
|
|
1734
|
+
referencedClasses: []
|
|
1513
1735
|
}),
|
|
1514
|
-
smalltalk.
|
|
1736
|
+
smalltalk.SymbolTest);
|
|
1515
1737
|
|
|
1516
1738
|
smalltalk.addMethod(
|
|
1517
|
-
"
|
|
1739
|
+
"_testAsString",
|
|
1518
1740
|
smalltalk.method({
|
|
1519
|
-
selector: "
|
|
1741
|
+
selector: "testAsString",
|
|
1520
1742
|
category: 'tests',
|
|
1521
1743
|
fn: function (){
|
|
1522
1744
|
var self=this;
|
|
1523
|
-
smalltalk.send(self,
|
|
1524
|
-
return self
|
|
1745
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"hello"]);
|
|
1746
|
+
return self},
|
|
1525
1747
|
args: [],
|
|
1526
|
-
source: "
|
|
1527
|
-
messageSends: ["assert:equals:", "
|
|
1528
|
-
referencedClasses: [
|
|
1748
|
+
source: "testAsString\x0a\x09self assert: #hello asString equals: 'hello'",
|
|
1749
|
+
messageSends: ["assert:equals:", "asString"],
|
|
1750
|
+
referencedClasses: []
|
|
1529
1751
|
}),
|
|
1530
|
-
smalltalk.
|
|
1752
|
+
smalltalk.SymbolTest);
|
|
1531
1753
|
|
|
1532
1754
|
smalltalk.addMethod(
|
|
1533
|
-
"
|
|
1755
|
+
"_testAsSymbol",
|
|
1534
1756
|
smalltalk.method({
|
|
1535
|
-
selector: "
|
|
1757
|
+
selector: "testAsSymbol",
|
|
1536
1758
|
category: 'tests',
|
|
1537
1759
|
fn: function (){
|
|
1538
1760
|
var self=this;
|
|
1539
|
-
smalltalk.send(self,
|
|
1540
|
-
|
|
1541
|
-
return self;},
|
|
1761
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_asSymbol",[])])]);
|
|
1762
|
+
return self},
|
|
1542
1763
|
args: [],
|
|
1543
|
-
source: "
|
|
1544
|
-
messageSends: ["assert:", "
|
|
1764
|
+
source: "testAsSymbol\x0a\x09self assert: #hello == #hello asSymbol",
|
|
1765
|
+
messageSends: ["assert:", "==", "asSymbol"],
|
|
1545
1766
|
referencedClasses: []
|
|
1546
1767
|
}),
|
|
1547
|
-
smalltalk.
|
|
1768
|
+
smalltalk.SymbolTest);
|
|
1548
1769
|
|
|
1549
1770
|
smalltalk.addMethod(
|
|
1550
|
-
"
|
|
1771
|
+
"_testAt",
|
|
1551
1772
|
smalltalk.method({
|
|
1552
|
-
selector: "
|
|
1773
|
+
selector: "testAt",
|
|
1553
1774
|
category: 'tests',
|
|
1554
1775
|
fn: function (){
|
|
1555
1776
|
var self=this;
|
|
1556
|
-
smalltalk.send(self,
|
|
1557
|
-
smalltalk.send(self,
|
|
1558
|
-
smalltalk.send(self,
|
|
1559
|
-
|
|
1560
|
-
|
|
1777
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(1)]),"__eq",["h"])]);
|
|
1778
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(5)]),"__eq",["o"])]);
|
|
1779
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_ifAbsent_",[(6),(function(){
|
|
1780
|
+
return nil;
|
|
1781
|
+
})]),"__eq",[nil])]);
|
|
1782
|
+
return self},
|
|
1561
1783
|
args: [],
|
|
1562
|
-
source: "
|
|
1563
|
-
messageSends: ["assert:
|
|
1784
|
+
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",
|
|
1785
|
+
messageSends: ["assert:", "=", "at:", "at:ifAbsent:"],
|
|
1564
1786
|
referencedClasses: []
|
|
1565
1787
|
}),
|
|
1566
|
-
smalltalk.
|
|
1567
|
-
|
|
1568
|
-
|
|
1788
|
+
smalltalk.SymbolTest);
|
|
1569
1789
|
|
|
1570
|
-
smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1571
1790
|
smalltalk.addMethod(
|
|
1572
|
-
"
|
|
1791
|
+
"_testAtPut",
|
|
1573
1792
|
smalltalk.method({
|
|
1574
|
-
selector: "
|
|
1793
|
+
selector: "testAtPut",
|
|
1575
1794
|
category: 'tests',
|
|
1576
1795
|
fn: function (){
|
|
1577
1796
|
var self=this;
|
|
1578
|
-
smalltalk.send(
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
return self
|
|
1797
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1798
|
+
return smalltalk.send("hello","_at_put_",[(1),"a"]);
|
|
1799
|
+
}),(smalltalk.Error || Error)]);
|
|
1800
|
+
return self},
|
|
1582
1801
|
args: [],
|
|
1583
|
-
source: "
|
|
1584
|
-
messageSends: ["
|
|
1585
|
-
referencedClasses: ["
|
|
1802
|
+
source: "testAtPut\x0a\x09\x22Symbol instances are read-only\x22\x0a\x09self should: ['hello' at: 1 put: 'a'] raise: Error",
|
|
1803
|
+
messageSends: ["should:raise:", "at:put:"],
|
|
1804
|
+
referencedClasses: ["Error"]
|
|
1586
1805
|
}),
|
|
1587
|
-
smalltalk.
|
|
1588
|
-
|
|
1589
|
-
|
|
1806
|
+
smalltalk.SymbolTest);
|
|
1590
1807
|
|
|
1591
|
-
smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1592
1808
|
smalltalk.addMethod(
|
|
1593
|
-
"
|
|
1809
|
+
"_testCollect",
|
|
1594
1810
|
smalltalk.method({
|
|
1595
|
-
selector: "
|
|
1811
|
+
selector: "testCollect",
|
|
1596
1812
|
category: 'tests',
|
|
1597
1813
|
fn: function (){
|
|
1598
1814
|
var self=this;
|
|
1599
|
-
var
|
|
1600
|
-
|
|
1601
|
-
smalltalk.send(self,
|
|
1602
|
-
smalltalk.send(
|
|
1603
|
-
|
|
1604
|
-
|
|
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)])]);
|
|
1608
|
-
return self;},
|
|
1815
|
+
var newCollection;
|
|
1816
|
+
newCollection=smalltalk.symbolFor("hheelllloo");
|
|
1817
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
|
|
1818
|
+
return smalltalk.send(each,"__comma",[each]);
|
|
1819
|
+
})]),newCollection]);
|
|
1820
|
+
return self},
|
|
1609
1821
|
args: [],
|
|
1610
|
-
source: "
|
|
1611
|
-
messageSends: ["
|
|
1612
|
-
referencedClasses: [
|
|
1822
|
+
source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #hheelllloo.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
|
|
1823
|
+
messageSends: ["assertSameContents:as:", "collect:", ",", "collection"],
|
|
1824
|
+
referencedClasses: []
|
|
1613
1825
|
}),
|
|
1614
|
-
smalltalk.
|
|
1826
|
+
smalltalk.SymbolTest);
|
|
1615
1827
|
|
|
1616
1828
|
smalltalk.addMethod(
|
|
1617
|
-
"
|
|
1829
|
+
"_testComparing",
|
|
1618
1830
|
smalltalk.method({
|
|
1619
|
-
selector: "
|
|
1831
|
+
selector: "testComparing",
|
|
1620
1832
|
category: 'tests',
|
|
1621
1833
|
fn: function (){
|
|
1622
1834
|
var self=this;
|
|
1623
|
-
smalltalk.send(self,
|
|
1624
|
-
|
|
1835
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("aa")])]);
|
|
1836
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("ba")])]);
|
|
1837
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt",[smalltalk.symbolFor("ba")])]);
|
|
1838
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt",[smalltalk.symbolFor("ba")])]);
|
|
1839
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("aa")])]);
|
|
1840
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("ba")])]);
|
|
1841
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
|
|
1842
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
|
|
1843
|
+
return self},
|
|
1625
1844
|
args: [],
|
|
1626
|
-
source: "
|
|
1627
|
-
messageSends: ["
|
|
1628
|
-
referencedClasses: [
|
|
1845
|
+
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",
|
|
1846
|
+
messageSends: ["assert:", ">", "deny:", "<", ">=", "<="],
|
|
1847
|
+
referencedClasses: []
|
|
1629
1848
|
}),
|
|
1630
|
-
smalltalk.
|
|
1849
|
+
smalltalk.SymbolTest);
|
|
1631
1850
|
|
|
1632
1851
|
smalltalk.addMethod(
|
|
1633
|
-
"
|
|
1852
|
+
"_testCopying",
|
|
1634
1853
|
smalltalk.method({
|
|
1635
|
-
selector: "
|
|
1854
|
+
selector: "testCopying",
|
|
1636
1855
|
category: 'tests',
|
|
1637
1856
|
fn: function (){
|
|
1638
1857
|
var self=this;
|
|
1639
|
-
smalltalk.send(self,
|
|
1640
|
-
smalltalk.send(self,
|
|
1641
|
-
|
|
1642
|
-
return self;},
|
|
1858
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_copy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
|
|
1859
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_deepCopy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
|
|
1860
|
+
return self},
|
|
1643
1861
|
args: [],
|
|
1644
|
-
source: "
|
|
1645
|
-
messageSends: ["assert:
|
|
1646
|
-
referencedClasses: [
|
|
1862
|
+
source: "testCopying\x0a\x09self assert: #hello copy == #hello.\x0a\x09self assert: #hello deepCopy == #hello",
|
|
1863
|
+
messageSends: ["assert:", "==", "copy", "deepCopy"],
|
|
1864
|
+
referencedClasses: []
|
|
1647
1865
|
}),
|
|
1648
|
-
smalltalk.
|
|
1866
|
+
smalltalk.SymbolTest);
|
|
1649
1867
|
|
|
1650
1868
|
smalltalk.addMethod(
|
|
1651
|
-
"
|
|
1869
|
+
"_testDetect",
|
|
1652
1870
|
smalltalk.method({
|
|
1653
|
-
selector: "
|
|
1871
|
+
selector: "testDetect",
|
|
1654
1872
|
category: 'tests',
|
|
1655
1873
|
fn: function (){
|
|
1656
1874
|
var self=this;
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
smalltalk.send(
|
|
1661
|
-
smalltalk.send(
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
return self;},
|
|
1875
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
1876
|
+
return smalltalk.send(each,"__eq",["h"]);
|
|
1877
|
+
})]),"__eq",["h"])]);
|
|
1878
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
1879
|
+
return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
|
|
1880
|
+
return smalltalk.send(each,"__eq",["z"]);
|
|
1881
|
+
})]);
|
|
1882
|
+
}),(smalltalk.Error || Error)]);
|
|
1883
|
+
return self},
|
|
1667
1884
|
args: [],
|
|
1668
|
-
source: "
|
|
1669
|
-
messageSends: ["
|
|
1670
|
-
referencedClasses: ["
|
|
1885
|
+
source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) = 'h'.\x0a\x09self \x0a\x09\x09should: [ self collection detect: [ :each | each = 'z' ] ]\x0a\x09\x09raise: Error",
|
|
1886
|
+
messageSends: ["assert:", "=", "detect:", "collection", "should:raise:"],
|
|
1887
|
+
referencedClasses: ["Error"]
|
|
1671
1888
|
}),
|
|
1672
|
-
smalltalk.
|
|
1673
|
-
|
|
1674
|
-
|
|
1889
|
+
smalltalk.SymbolTest);
|
|
1675
1890
|
|
|
1676
|
-
smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1677
1891
|
smalltalk.addMethod(
|
|
1678
|
-
"
|
|
1892
|
+
"_testEquality",
|
|
1679
1893
|
smalltalk.method({
|
|
1680
|
-
selector: "
|
|
1894
|
+
selector: "testEquality",
|
|
1681
1895
|
category: 'tests',
|
|
1682
1896
|
fn: function (){
|
|
1683
1897
|
var self=this;
|
|
1684
|
-
smalltalk.send(self,
|
|
1685
|
-
smalltalk.send(self,
|
|
1686
|
-
|
|
1898
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("hello")])]);
|
|
1899
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("world")])]);
|
|
1900
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
|
|
1901
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.symbolFor("hello")])]);
|
|
1902
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",["hello"])]);
|
|
1903
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",[smalltalk.symbolFor("hello")])]);
|
|
1904
|
+
return self},
|
|
1905
|
+
args: [],
|
|
1906
|
+
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.",
|
|
1907
|
+
messageSends: ["assert:", "=", "deny:", "yourself"],
|
|
1908
|
+
referencedClasses: []
|
|
1909
|
+
}),
|
|
1910
|
+
smalltalk.SymbolTest);
|
|
1911
|
+
|
|
1912
|
+
smalltalk.addMethod(
|
|
1913
|
+
"_testIdentity",
|
|
1914
|
+
smalltalk.method({
|
|
1915
|
+
selector: "testIdentity",
|
|
1916
|
+
category: 'tests',
|
|
1917
|
+
fn: function (){
|
|
1918
|
+
var self=this;
|
|
1919
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("hello")])]);
|
|
1920
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("world")])]);
|
|
1921
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
|
|
1922
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"_asSymbol",[])])]);
|
|
1923
|
+
return self},
|
|
1924
|
+
args: [],
|
|
1925
|
+
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",
|
|
1926
|
+
messageSends: ["assert:", "==", "deny:", "=", "yourself", "asSymbol", "asString"],
|
|
1927
|
+
referencedClasses: []
|
|
1928
|
+
}),
|
|
1929
|
+
smalltalk.SymbolTest);
|
|
1930
|
+
|
|
1931
|
+
smalltalk.addMethod(
|
|
1932
|
+
"_testIsEmpty",
|
|
1933
|
+
smalltalk.method({
|
|
1934
|
+
selector: "testIsEmpty",
|
|
1935
|
+
category: 'tests',
|
|
1936
|
+
fn: function (){
|
|
1937
|
+
var self=this;
|
|
1938
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
|
|
1939
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("","_asSymbol",[]),"_isEmpty",[])]);
|
|
1940
|
+
return self},
|
|
1941
|
+
args: [],
|
|
1942
|
+
source: "testIsEmpty\x0a\x09self deny: self collection isEmpty.\x0a\x09self assert: '' asSymbol isEmpty",
|
|
1943
|
+
messageSends: ["deny:", "isEmpty", "collection", "assert:", "asSymbol"],
|
|
1944
|
+
referencedClasses: []
|
|
1945
|
+
}),
|
|
1946
|
+
smalltalk.SymbolTest);
|
|
1947
|
+
|
|
1948
|
+
smalltalk.addMethod(
|
|
1949
|
+
"_testIsSymbolIsString",
|
|
1950
|
+
smalltalk.method({
|
|
1951
|
+
selector: "testIsSymbolIsString",
|
|
1952
|
+
category: 'tests',
|
|
1953
|
+
fn: function (){
|
|
1954
|
+
var self=this;
|
|
1955
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isSymbol",[])]);
|
|
1956
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("hello","_isSymbol",[])]);
|
|
1957
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isString",[])]);
|
|
1958
|
+
smalltalk.send(self,"_assert_",[smalltalk.send("hello","_isString",[])]);
|
|
1959
|
+
return self},
|
|
1960
|
+
args: [],
|
|
1961
|
+
source: "testIsSymbolIsString\x0a\x09self assert: #hello isSymbol.\x0a\x09self deny: 'hello' isSymbol.\x0a\x09self deny: #hello isString.\x0a\x09self assert: 'hello' isString",
|
|
1962
|
+
messageSends: ["assert:", "isSymbol", "deny:", "isString"],
|
|
1963
|
+
referencedClasses: []
|
|
1964
|
+
}),
|
|
1965
|
+
smalltalk.SymbolTest);
|
|
1966
|
+
|
|
1967
|
+
smalltalk.addMethod(
|
|
1968
|
+
"_testSelect",
|
|
1969
|
+
smalltalk.method({
|
|
1970
|
+
selector: "testSelect",
|
|
1971
|
+
category: 'tests',
|
|
1972
|
+
fn: function (){
|
|
1973
|
+
var self=this;
|
|
1974
|
+
var newCollection;
|
|
1975
|
+
newCollection="o";
|
|
1976
|
+
smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
|
|
1977
|
+
return smalltalk.send(each,"__eq",["o"]);
|
|
1978
|
+
})]),newCollection]);
|
|
1979
|
+
return self},
|
|
1980
|
+
args: [],
|
|
1981
|
+
source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self \x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
|
|
1982
|
+
messageSends: ["assertSameContents:as:", "select:", "=", "collection"],
|
|
1983
|
+
referencedClasses: []
|
|
1984
|
+
}),
|
|
1985
|
+
smalltalk.SymbolTest);
|
|
1986
|
+
|
|
1987
|
+
smalltalk.addMethod(
|
|
1988
|
+
"_testSize",
|
|
1989
|
+
smalltalk.method({
|
|
1990
|
+
selector: "testSize",
|
|
1991
|
+
category: 'tests',
|
|
1992
|
+
fn: function (){
|
|
1993
|
+
var self=this;
|
|
1994
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("a"),"_size",[]),(1)]);
|
|
1995
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("aaaaa"),"_size",[]),(5)]);
|
|
1996
|
+
return self},
|
|
1997
|
+
args: [],
|
|
1998
|
+
source: "testSize\x0a\x09self assert: #a size equals: 1.\x0a\x09self assert: #aaaaa size equals: 5",
|
|
1999
|
+
messageSends: ["assert:equals:", "size"],
|
|
2000
|
+
referencedClasses: []
|
|
2001
|
+
}),
|
|
2002
|
+
smalltalk.SymbolTest);
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
smalltalk.addMethod(
|
|
2006
|
+
"_collectionClass",
|
|
2007
|
+
smalltalk.method({
|
|
2008
|
+
selector: "collectionClass",
|
|
2009
|
+
category: 'accessing',
|
|
2010
|
+
fn: function (){
|
|
2011
|
+
var self=this;
|
|
2012
|
+
return (smalltalk.Symbol || Symbol);
|
|
2013
|
+
},
|
|
2014
|
+
args: [],
|
|
2015
|
+
source: "collectionClass\x0a\x09^ Symbol",
|
|
2016
|
+
messageSends: [],
|
|
2017
|
+
referencedClasses: ["Symbol"]
|
|
2018
|
+
}),
|
|
2019
|
+
smalltalk.SymbolTest.klass);
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
2023
|
+
smalltalk.addMethod(
|
|
2024
|
+
"_jsObject",
|
|
2025
|
+
smalltalk.method({
|
|
2026
|
+
selector: "jsObject",
|
|
2027
|
+
category: 'accessing',
|
|
2028
|
+
fn: function (){
|
|
2029
|
+
var self=this;
|
|
2030
|
+
return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: ''};
|
|
2031
|
+
;
|
|
2032
|
+
return self},
|
|
2033
|
+
args: [],
|
|
2034
|
+
source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: ''}>",
|
|
2035
|
+
messageSends: [],
|
|
2036
|
+
referencedClasses: []
|
|
2037
|
+
}),
|
|
2038
|
+
smalltalk.JSObjectProxyTest);
|
|
2039
|
+
|
|
2040
|
+
smalltalk.addMethod(
|
|
2041
|
+
"_testDNU",
|
|
2042
|
+
smalltalk.method({
|
|
2043
|
+
selector: "testDNU",
|
|
2044
|
+
category: 'tests',
|
|
2045
|
+
fn: function (){
|
|
2046
|
+
var self=this;
|
|
2047
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
2048
|
+
return smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_foo",[]);
|
|
2049
|
+
}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
|
|
2050
|
+
return self},
|
|
2051
|
+
args: [],
|
|
2052
|
+
source: "testDNU\x0a\x09self should: [self jsObject foo] raise: MessageNotUnderstood",
|
|
2053
|
+
messageSends: ["should:raise:", "foo", "jsObject"],
|
|
2054
|
+
referencedClasses: ["MessageNotUnderstood"]
|
|
2055
|
+
}),
|
|
2056
|
+
smalltalk.JSObjectProxyTest);
|
|
2057
|
+
|
|
2058
|
+
smalltalk.addMethod(
|
|
2059
|
+
"_testMessageSend",
|
|
2060
|
+
smalltalk.method({
|
|
2061
|
+
selector: "testMessageSend",
|
|
2062
|
+
category: 'tests',
|
|
2063
|
+
fn: function (){
|
|
2064
|
+
var self=this;
|
|
2065
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_a",[]),(1)]);
|
|
2066
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_b",[]),(2)]);
|
|
2067
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(3)]),(3)]);
|
|
2068
|
+
return self},
|
|
2069
|
+
args: [],
|
|
2070
|
+
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",
|
|
2071
|
+
messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
|
|
2072
|
+
referencedClasses: []
|
|
2073
|
+
}),
|
|
2074
|
+
smalltalk.JSObjectProxyTest);
|
|
2075
|
+
|
|
2076
|
+
smalltalk.addMethod(
|
|
2077
|
+
"_testMethodWithArguments",
|
|
2078
|
+
smalltalk.method({
|
|
2079
|
+
selector: "testMethodWithArguments",
|
|
2080
|
+
category: 'tests',
|
|
2081
|
+
fn: function (){
|
|
2082
|
+
var self=this;
|
|
2083
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(1)]),(1)]);
|
|
2084
|
+
return self},
|
|
2085
|
+
args: [],
|
|
2086
|
+
source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
|
|
2087
|
+
messageSends: ["assert:equals:", "c:", "jsObject"],
|
|
2088
|
+
referencedClasses: []
|
|
2089
|
+
}),
|
|
2090
|
+
smalltalk.JSObjectProxyTest);
|
|
2091
|
+
|
|
2092
|
+
smalltalk.addMethod(
|
|
2093
|
+
"_testPrinting",
|
|
2094
|
+
smalltalk.method({
|
|
2095
|
+
selector: "testPrinting",
|
|
2096
|
+
category: 'tests',
|
|
2097
|
+
fn: function (){
|
|
2098
|
+
var self=this;
|
|
2099
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_printString",[]),"__eq",["[object Object]"])]);
|
|
2100
|
+
return self},
|
|
2101
|
+
args: [],
|
|
2102
|
+
source: "testPrinting\x0a\x09self assert: self jsObject printString = '[object Object]'",
|
|
2103
|
+
messageSends: ["assert:", "=", "printString", "jsObject"],
|
|
2104
|
+
referencedClasses: []
|
|
2105
|
+
}),
|
|
2106
|
+
smalltalk.JSObjectProxyTest);
|
|
2107
|
+
|
|
2108
|
+
smalltalk.addMethod(
|
|
2109
|
+
"_testPropertyThatReturnsEmptyString",
|
|
2110
|
+
smalltalk.method({
|
|
2111
|
+
selector: "testPropertyThatReturnsEmptyString",
|
|
2112
|
+
category: 'tests',
|
|
2113
|
+
fn: function (){
|
|
2114
|
+
var self=this;
|
|
2115
|
+
var object;
|
|
2116
|
+
object=smalltalk.send(self,"_jsObject",[]);
|
|
2117
|
+
smalltalk.send(self,"_assert_equals_",["",smalltalk.send(object,"_d",[])]);
|
|
2118
|
+
smalltalk.send(object,"_d_",["hello"]);
|
|
2119
|
+
smalltalk.send(self,"_assert_equals_",["hello",smalltalk.send(object,"_d",[])]);
|
|
2120
|
+
return self},
|
|
2121
|
+
args: [],
|
|
2122
|
+
source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: '' equals: object d.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: 'hello' equals: object d",
|
|
2123
|
+
messageSends: ["jsObject", "assert:equals:", "d", "d:"],
|
|
2124
|
+
referencedClasses: []
|
|
2125
|
+
}),
|
|
2126
|
+
smalltalk.JSObjectProxyTest);
|
|
2127
|
+
|
|
2128
|
+
smalltalk.addMethod(
|
|
2129
|
+
"_testYourself",
|
|
2130
|
+
smalltalk.method({
|
|
2131
|
+
selector: "testYourself",
|
|
2132
|
+
category: 'tests',
|
|
2133
|
+
fn: function (){
|
|
2134
|
+
var self=this;
|
|
2135
|
+
var $1,$2;
|
|
2136
|
+
var object;
|
|
2137
|
+
$1=smalltalk.send(self,"_jsObject",[]);
|
|
2138
|
+
smalltalk.send($1,"_d_",["test"]);
|
|
2139
|
+
$2=smalltalk.send($1,"_yourself",[]);
|
|
2140
|
+
object=$2;
|
|
2141
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(object,"_d",[]),"test"]);
|
|
2142
|
+
return self},
|
|
2143
|
+
args: [],
|
|
2144
|
+
source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
|
|
2145
|
+
messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
|
|
2146
|
+
referencedClasses: []
|
|
2147
|
+
}),
|
|
2148
|
+
smalltalk.JSObjectProxyTest);
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
2153
|
+
smalltalk.addMethod(
|
|
2154
|
+
"_testAbs",
|
|
2155
|
+
smalltalk.method({
|
|
2156
|
+
selector: "testAbs",
|
|
2157
|
+
category: 'tests',
|
|
2158
|
+
fn: function (){
|
|
2159
|
+
var self=this;
|
|
2160
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_abs",[]),"__eq",[(4)])]);
|
|
2161
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-4),"_abs",[]),"__eq",[(4)])]);
|
|
2162
|
+
return self},
|
|
2163
|
+
args: [],
|
|
2164
|
+
source: "testAbs\x0a\x09self assert: 4 abs = 4.\x0a\x09self assert: -4 abs = 4",
|
|
2165
|
+
messageSends: ["assert:", "=", "abs"],
|
|
2166
|
+
referencedClasses: []
|
|
2167
|
+
}),
|
|
2168
|
+
smalltalk.NumberTest);
|
|
2169
|
+
|
|
2170
|
+
smalltalk.addMethod(
|
|
2171
|
+
"_testArithmetic",
|
|
2172
|
+
smalltalk.method({
|
|
2173
|
+
selector: "testArithmetic",
|
|
2174
|
+
category: 'tests',
|
|
2175
|
+
fn: function (){
|
|
2176
|
+
var self=this;
|
|
2177
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1.5),"__plus",[(1)]),"__eq",[(2.5)])]);
|
|
2178
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((2),"__minus",[(1)]),"__eq",[(1)])]);
|
|
2179
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-2),"__minus",[(1)]),"__eq",[(-3)])]);
|
|
2180
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((12),"__slash",[(2)]),"__eq",[(6)])]);
|
|
2181
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__star",[(4)]),"__eq",[(12)])]);
|
|
2182
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((1),"__plus",[(2)]),"__star",[(3)]),"__eq",[(9)])]);
|
|
2183
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__plus",[smalltalk.send((2),"__star",[(3)])]),"__eq",[(7)])]);
|
|
2184
|
+
return self},
|
|
2185
|
+
args: [],
|
|
2186
|
+
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",
|
|
2187
|
+
messageSends: ["assert:", "=", "+", "-", "/", "*"],
|
|
2188
|
+
referencedClasses: []
|
|
2189
|
+
}),
|
|
2190
|
+
smalltalk.NumberTest);
|
|
2191
|
+
|
|
2192
|
+
smalltalk.addMethod(
|
|
2193
|
+
"_testComparison",
|
|
2194
|
+
smalltalk.method({
|
|
2195
|
+
selector: "testComparison",
|
|
2196
|
+
category: 'tests',
|
|
2197
|
+
fn: function (){
|
|
2198
|
+
var self=this;
|
|
2199
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt",[(2)])]);
|
|
2200
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((2),"__lt",[(3)])]);
|
|
2201
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((3),"__lt",[(2)])]);
|
|
2202
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((2),"__gt",[(3)])]);
|
|
2203
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt_eq",[(3)])]);
|
|
2204
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((3.1),"__gt_eq",[(3)])]);
|
|
2205
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3)])]);
|
|
2206
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3.1)])]);
|
|
2207
|
+
return self},
|
|
2208
|
+
args: [],
|
|
2209
|
+
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",
|
|
2210
|
+
messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
|
|
2211
|
+
referencedClasses: []
|
|
2212
|
+
}),
|
|
2213
|
+
smalltalk.NumberTest);
|
|
2214
|
+
|
|
2215
|
+
smalltalk.addMethod(
|
|
2216
|
+
"_testCopying",
|
|
2217
|
+
smalltalk.method({
|
|
2218
|
+
selector: "testCopying",
|
|
2219
|
+
category: 'tests',
|
|
2220
|
+
fn: function (){
|
|
2221
|
+
var self=this;
|
|
2222
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_copy",[]),"__eq_eq",[(1)])]);
|
|
2223
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_deepCopy",[]),"__eq_eq",[(1)])]);
|
|
2224
|
+
return self},
|
|
2225
|
+
args: [],
|
|
2226
|
+
source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
|
|
2227
|
+
messageSends: ["assert:", "==", "copy", "deepCopy"],
|
|
2228
|
+
referencedClasses: []
|
|
2229
|
+
}),
|
|
2230
|
+
smalltalk.NumberTest);
|
|
2231
|
+
|
|
2232
|
+
smalltalk.addMethod(
|
|
2233
|
+
"_testEquality",
|
|
2234
|
+
smalltalk.method({
|
|
2235
|
+
selector: "testEquality",
|
|
2236
|
+
category: 'tests',
|
|
2237
|
+
fn: function (){
|
|
2238
|
+
var self=this;
|
|
2239
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[(1)])]);
|
|
2240
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq",[(0)])]);
|
|
2241
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq",[(0)])]);
|
|
2242
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[(1)])]);
|
|
2243
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[smalltalk.send((1),"_yourself",[])])]);
|
|
2244
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[smalltalk.send((1),"_yourself",[])])]);
|
|
2245
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
|
|
2246
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
|
|
2247
|
+
smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
|
|
2248
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[""])]);
|
|
2249
|
+
return self},
|
|
2250
|
+
args: [],
|
|
2251
|
+
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 = ''",
|
|
2252
|
+
messageSends: ["assert:", "=", "deny:", "yourself"],
|
|
2253
|
+
referencedClasses: []
|
|
2254
|
+
}),
|
|
2255
|
+
smalltalk.NumberTest);
|
|
2256
|
+
|
|
2257
|
+
smalltalk.addMethod(
|
|
2258
|
+
"_testIdentity",
|
|
2259
|
+
smalltalk.method({
|
|
2260
|
+
selector: "testIdentity",
|
|
2261
|
+
category: 'tests',
|
|
2262
|
+
fn: function (){
|
|
2263
|
+
var self=this;
|
|
2264
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[(1)])]);
|
|
2265
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq_eq",[(0)])]);
|
|
2266
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(0)])]);
|
|
2267
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[(1)])]);
|
|
2268
|
+
smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
|
|
2269
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
|
|
2270
|
+
smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(2)])]);
|
|
2271
|
+
return self},
|
|
2272
|
+
args: [],
|
|
2273
|
+
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",
|
|
2274
|
+
messageSends: ["assert:", "==", "deny:", "yourself"],
|
|
2275
|
+
referencedClasses: []
|
|
2276
|
+
}),
|
|
2277
|
+
smalltalk.NumberTest);
|
|
2278
|
+
|
|
2279
|
+
smalltalk.addMethod(
|
|
2280
|
+
"_testMinMax",
|
|
2281
|
+
smalltalk.method({
|
|
2282
|
+
selector: "testMinMax",
|
|
2283
|
+
category: 'tests',
|
|
2284
|
+
fn: function (){
|
|
2285
|
+
var self=this;
|
|
2286
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_max_",[(5)]),(5)]);
|
|
2287
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_min_",[(5)]),(2)]);
|
|
2288
|
+
return self},
|
|
2289
|
+
args: [],
|
|
2290
|
+
source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
|
|
2291
|
+
messageSends: ["assert:equals:", "max:", "min:"],
|
|
2292
|
+
referencedClasses: []
|
|
2293
|
+
}),
|
|
2294
|
+
smalltalk.NumberTest);
|
|
2295
|
+
|
|
2296
|
+
smalltalk.addMethod(
|
|
2297
|
+
"_testNegated",
|
|
2298
|
+
smalltalk.method({
|
|
2299
|
+
selector: "testNegated",
|
|
2300
|
+
category: 'tests',
|
|
2301
|
+
fn: function (){
|
|
2302
|
+
var self=this;
|
|
2303
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_negated",[]),"__eq",[(-3)])]);
|
|
2304
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-3),"_negated",[]),"__eq",[(3)])]);
|
|
2305
|
+
return self},
|
|
2306
|
+
args: [],
|
|
2307
|
+
source: "testNegated\x0a\x09self assert: 3 negated = -3.\x0a\x09self assert: -3 negated = 3",
|
|
2308
|
+
messageSends: ["assert:", "=", "negated"],
|
|
2309
|
+
referencedClasses: []
|
|
2310
|
+
}),
|
|
2311
|
+
smalltalk.NumberTest);
|
|
2312
|
+
|
|
2313
|
+
smalltalk.addMethod(
|
|
2314
|
+
"_testPrintShowingDecimalPlaces",
|
|
2315
|
+
smalltalk.method({
|
|
2316
|
+
selector: "testPrintShowingDecimalPlaces",
|
|
2317
|
+
category: 'tests',
|
|
2318
|
+
fn: function (){
|
|
2319
|
+
var self=this;
|
|
2320
|
+
smalltalk.send(self,"_assert_equals_",["23.00",smalltalk.send((23),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2321
|
+
smalltalk.send(self,"_assert_equals_",["23.57",smalltalk.send((23.5698),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2322
|
+
smalltalk.send(self,"_assert_equals_",["-234.56700",smalltalk.send(smalltalk.send((234.567),"_negated",[]),"_printShowingDecimalPlaces_",[(5)])]);
|
|
2323
|
+
smalltalk.send(self,"_assert_equals_",["23",smalltalk.send((23.4567),"_printShowingDecimalPlaces_",[(0)])]);
|
|
2324
|
+
smalltalk.send(self,"_assert_equals_",["24",smalltalk.send((23.5567),"_printShowingDecimalPlaces_",[(0)])]);
|
|
2325
|
+
smalltalk.send(self,"_assert_equals_",["-23",smalltalk.send(smalltalk.send((23.4567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
|
|
2326
|
+
smalltalk.send(self,"_assert_equals_",["-24",smalltalk.send(smalltalk.send((23.5567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
|
|
2327
|
+
smalltalk.send(self,"_assert_equals_",["100000000.0",smalltalk.send((100000000),"_printShowingDecimalPlaces_",[(1)])]);
|
|
2328
|
+
smalltalk.send(self,"_assert_equals_",["0.98000",smalltalk.send((0.98),"_printShowingDecimalPlaces_",[(5)])]);
|
|
2329
|
+
smalltalk.send(self,"_assert_equals_",["-0.98",smalltalk.send(smalltalk.send((0.98),"_negated",[]),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2330
|
+
smalltalk.send(self,"_assert_equals_",["2.57",smalltalk.send((2.567),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2331
|
+
smalltalk.send(self,"_assert_equals_",["-2.57",smalltalk.send((-2.567),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2332
|
+
smalltalk.send(self,"_assert_equals_",["0.00",smalltalk.send((0),"_printShowingDecimalPlaces_",[(2)])]);
|
|
2333
|
+
return self},
|
|
2334
|
+
args: [],
|
|
2335
|
+
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).",
|
|
2336
|
+
messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
|
|
2337
|
+
referencedClasses: []
|
|
2338
|
+
}),
|
|
2339
|
+
smalltalk.NumberTest);
|
|
2340
|
+
|
|
2341
|
+
smalltalk.addMethod(
|
|
2342
|
+
"_testRounded",
|
|
2343
|
+
smalltalk.method({
|
|
2344
|
+
selector: "testRounded",
|
|
2345
|
+
category: 'tests',
|
|
2346
|
+
fn: function (){
|
|
2347
|
+
var self=this;
|
|
2348
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_rounded",[]),"__eq",[(3)])]);
|
|
2349
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_rounded",[]),"__eq",[(3)])]);
|
|
2350
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_rounded",[]),"__eq",[(4)])]);
|
|
2351
|
+
return self},
|
|
2352
|
+
args: [],
|
|
2353
|
+
source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded = 3.\x0a\x09self assert: 3.212 rounded = 3.\x0a\x09self assert: 3.51 rounded = 4",
|
|
2354
|
+
messageSends: ["assert:", "=", "rounded"],
|
|
2355
|
+
referencedClasses: []
|
|
2356
|
+
}),
|
|
2357
|
+
smalltalk.NumberTest);
|
|
2358
|
+
|
|
2359
|
+
smalltalk.addMethod(
|
|
2360
|
+
"_testSqrt",
|
|
2361
|
+
smalltalk.method({
|
|
2362
|
+
selector: "testSqrt",
|
|
2363
|
+
category: 'tests',
|
|
2364
|
+
fn: function (){
|
|
2365
|
+
var self=this;
|
|
2366
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_sqrt",[]),"__eq",[(2)])]);
|
|
2367
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((16),"_sqrt",[]),"__eq",[(4)])]);
|
|
2368
|
+
return self},
|
|
2369
|
+
args: [],
|
|
2370
|
+
source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt = 2.\x0a\x09self assert: 16 sqrt = 4",
|
|
2371
|
+
messageSends: ["assert:", "=", "sqrt"],
|
|
2372
|
+
referencedClasses: []
|
|
2373
|
+
}),
|
|
2374
|
+
smalltalk.NumberTest);
|
|
2375
|
+
|
|
2376
|
+
smalltalk.addMethod(
|
|
2377
|
+
"_testSquared",
|
|
2378
|
+
smalltalk.method({
|
|
2379
|
+
selector: "testSquared",
|
|
2380
|
+
category: 'tests',
|
|
2381
|
+
fn: function (){
|
|
2382
|
+
var self=this;
|
|
2383
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_squared",[]),"__eq",[(16)])]);
|
|
2384
|
+
return self},
|
|
2385
|
+
args: [],
|
|
2386
|
+
source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared = 16",
|
|
2387
|
+
messageSends: ["assert:", "=", "squared"],
|
|
2388
|
+
referencedClasses: []
|
|
2389
|
+
}),
|
|
2390
|
+
smalltalk.NumberTest);
|
|
2391
|
+
|
|
2392
|
+
smalltalk.addMethod(
|
|
2393
|
+
"_testTimesRepeat",
|
|
2394
|
+
smalltalk.method({
|
|
2395
|
+
selector: "testTimesRepeat",
|
|
2396
|
+
category: 'tests',
|
|
2397
|
+
fn: function (){
|
|
2398
|
+
var self=this;
|
|
2399
|
+
var i;
|
|
2400
|
+
i=(0);
|
|
2401
|
+
smalltalk.send((0),"_timesRepeat_",[(function(){
|
|
2402
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
2403
|
+
return i;
|
|
2404
|
+
})]);
|
|
2405
|
+
smalltalk.send(self,"_assert_equals_",[i,(0)]);
|
|
2406
|
+
smalltalk.send((5),"_timesRepeat_",[(function(){
|
|
2407
|
+
i=smalltalk.send(i,"__plus",[(1)]);
|
|
2408
|
+
return i;
|
|
2409
|
+
})]);
|
|
2410
|
+
smalltalk.send(self,"_assert_equals_",[i,(5)]);
|
|
2411
|
+
return self},
|
|
2412
|
+
args: [],
|
|
2413
|
+
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",
|
|
2414
|
+
messageSends: ["timesRepeat:", "+", "assert:equals:"],
|
|
2415
|
+
referencedClasses: []
|
|
2416
|
+
}),
|
|
2417
|
+
smalltalk.NumberTest);
|
|
2418
|
+
|
|
2419
|
+
smalltalk.addMethod(
|
|
2420
|
+
"_testTo",
|
|
2421
|
+
smalltalk.method({
|
|
2422
|
+
selector: "testTo",
|
|
2423
|
+
category: 'tests',
|
|
2424
|
+
fn: function (){
|
|
2425
|
+
var self=this;
|
|
2426
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((1),"_to_",[(5)]),[(1), (2), (3), (4), (5)]]);
|
|
2427
|
+
return self},
|
|
2428
|
+
args: [],
|
|
2429
|
+
source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
|
|
2430
|
+
messageSends: ["assert:equals:", "to:"],
|
|
2431
|
+
referencedClasses: []
|
|
2432
|
+
}),
|
|
2433
|
+
smalltalk.NumberTest);
|
|
2434
|
+
|
|
2435
|
+
smalltalk.addMethod(
|
|
2436
|
+
"_testToBy",
|
|
2437
|
+
smalltalk.method({
|
|
2438
|
+
selector: "testToBy",
|
|
2439
|
+
category: 'tests',
|
|
2440
|
+
fn: function (){
|
|
2441
|
+
var self=this;
|
|
2442
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((0),"_to_by_",[(6),(2)]),[(0), (2), (4), (6)]]);
|
|
2443
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
2444
|
+
return smalltalk.send((1),"_to_by_",[(4),(0)]);
|
|
2445
|
+
}),(smalltalk.Error || Error)]);
|
|
2446
|
+
return self},
|
|
2447
|
+
args: [],
|
|
2448
|
+
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",
|
|
2449
|
+
messageSends: ["assert:equals:", "to:by:", "should:raise:"],
|
|
2450
|
+
referencedClasses: ["Error"]
|
|
2451
|
+
}),
|
|
2452
|
+
smalltalk.NumberTest);
|
|
2453
|
+
|
|
2454
|
+
smalltalk.addMethod(
|
|
2455
|
+
"_testTruncated",
|
|
2456
|
+
smalltalk.method({
|
|
2457
|
+
selector: "testTruncated",
|
|
2458
|
+
category: 'tests',
|
|
2459
|
+
fn: function (){
|
|
2460
|
+
var self=this;
|
|
2461
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_truncated",[]),"__eq",[(3)])]);
|
|
2462
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_truncated",[]),"__eq",[(3)])]);
|
|
2463
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_truncated",[]),"__eq",[(3)])]);
|
|
2464
|
+
return self},
|
|
2465
|
+
args: [],
|
|
2466
|
+
source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated = 3.\x0a\x09self assert: 3.212 truncated = 3.\x0a\x09self assert: 3.51 truncated = 3",
|
|
2467
|
+
messageSends: ["assert:", "=", "truncated"],
|
|
2468
|
+
referencedClasses: []
|
|
2469
|
+
}),
|
|
2470
|
+
smalltalk.NumberTest);
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
|
|
2475
|
+
smalltalk.addMethod(
|
|
2476
|
+
"_foo",
|
|
2477
|
+
smalltalk.method({
|
|
2478
|
+
selector: "foo",
|
|
2479
|
+
category: 'not yet classified',
|
|
2480
|
+
fn: function (){
|
|
2481
|
+
var self=this;
|
|
2482
|
+
return self["@foo"];
|
|
2483
|
+
},
|
|
2484
|
+
args: [],
|
|
2485
|
+
source: "foo\x0a\x09^foo",
|
|
2486
|
+
messageSends: [],
|
|
2487
|
+
referencedClasses: []
|
|
2488
|
+
}),
|
|
2489
|
+
smalltalk.ObjectMock);
|
|
2490
|
+
|
|
2491
|
+
smalltalk.addMethod(
|
|
2492
|
+
"_foo_",
|
|
2493
|
+
smalltalk.method({
|
|
2494
|
+
selector: "foo:",
|
|
2495
|
+
category: 'not yet classified',
|
|
2496
|
+
fn: function (anObject){
|
|
2497
|
+
var self=this;
|
|
2498
|
+
self["@foo"]=anObject;
|
|
2499
|
+
return self},
|
|
2500
|
+
args: ["anObject"],
|
|
2501
|
+
source: "foo: anObject\x0a\x09foo := anObject",
|
|
2502
|
+
messageSends: [],
|
|
2503
|
+
referencedClasses: []
|
|
2504
|
+
}),
|
|
2505
|
+
smalltalk.ObjectMock);
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
2510
|
+
smalltalk.addMethod(
|
|
2511
|
+
"_testBasicAccess",
|
|
2512
|
+
smalltalk.method({
|
|
2513
|
+
selector: "testBasicAccess",
|
|
2514
|
+
category: 'tests',
|
|
2515
|
+
fn: function (){
|
|
2516
|
+
var self=this;
|
|
2517
|
+
var o;
|
|
2518
|
+
o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2519
|
+
smalltalk.send(o,"_basicAt_put_",["a",(1)]);
|
|
2520
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["a"]),(1)]);
|
|
2521
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["b"]),nil]);
|
|
2522
|
+
return self},
|
|
2523
|
+
args: [],
|
|
2524
|
+
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",
|
|
2525
|
+
messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
|
|
2526
|
+
referencedClasses: ["Object"]
|
|
2527
|
+
}),
|
|
2528
|
+
smalltalk.ObjectTest);
|
|
2529
|
+
|
|
2530
|
+
smalltalk.addMethod(
|
|
2531
|
+
"_testBasicPerform",
|
|
2532
|
+
smalltalk.method({
|
|
2533
|
+
selector: "testBasicPerform",
|
|
2534
|
+
category: 'tests',
|
|
2535
|
+
fn: function (){
|
|
2536
|
+
var self=this;
|
|
2537
|
+
var o;
|
|
2538
|
+
o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2539
|
+
smalltalk.send(o,"_basicAt_put_",["func",(function(){
|
|
2540
|
+
return "hello";
|
|
2541
|
+
})]);
|
|
2542
|
+
smalltalk.send(o,"_basicAt_put_",["func2",(function(a){
|
|
2543
|
+
return smalltalk.send(a,"__plus",[(1)]);
|
|
2544
|
+
})]);
|
|
2545
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_",["func"]),"hello"]);
|
|
2546
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_withArguments_",["func2",[(3)]]),(4)]);
|
|
2547
|
+
return self},
|
|
2548
|
+
args: [],
|
|
2549
|
+
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",
|
|
2550
|
+
messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
|
|
2551
|
+
referencedClasses: ["Object"]
|
|
2552
|
+
}),
|
|
2553
|
+
smalltalk.ObjectTest);
|
|
2554
|
+
|
|
2555
|
+
smalltalk.addMethod(
|
|
2556
|
+
"_testDNU",
|
|
2557
|
+
smalltalk.method({
|
|
2558
|
+
selector: "testDNU",
|
|
2559
|
+
category: 'tests',
|
|
2560
|
+
fn: function (){
|
|
2561
|
+
var self=this;
|
|
2562
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
2563
|
+
return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_foo",[]);
|
|
2564
|
+
}),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
|
|
2565
|
+
return self},
|
|
2566
|
+
args: [],
|
|
2567
|
+
source: "testDNU\x0a\x09self should: [Object new foo] raise: MessageNotUnderstood",
|
|
2568
|
+
messageSends: ["should:raise:", "foo", "new"],
|
|
2569
|
+
referencedClasses: ["Object", "MessageNotUnderstood"]
|
|
2570
|
+
}),
|
|
2571
|
+
smalltalk.ObjectTest);
|
|
2572
|
+
|
|
2573
|
+
smalltalk.addMethod(
|
|
2574
|
+
"_testEquality",
|
|
2575
|
+
smalltalk.method({
|
|
2576
|
+
selector: "testEquality",
|
|
2577
|
+
category: 'tests',
|
|
2578
|
+
fn: function (){
|
|
2579
|
+
var self=this;
|
|
2580
|
+
var o;
|
|
2581
|
+
o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2582
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
|
|
2583
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[o])]);
|
|
2584
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq",[o])]);
|
|
2585
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[smalltalk.send(o,"_yourself",[])])]);
|
|
2586
|
+
return self},
|
|
2587
|
+
args: [],
|
|
2588
|
+
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",
|
|
2589
|
+
messageSends: ["new", "deny:", "=", "assert:", "yourself"],
|
|
2590
|
+
referencedClasses: ["Object"]
|
|
2591
|
+
}),
|
|
2592
|
+
smalltalk.ObjectTest);
|
|
2593
|
+
|
|
2594
|
+
smalltalk.addMethod(
|
|
2595
|
+
"_testHalt",
|
|
2596
|
+
smalltalk.method({
|
|
2597
|
+
selector: "testHalt",
|
|
2598
|
+
category: 'tests',
|
|
2599
|
+
fn: function (){
|
|
2600
|
+
var self=this;
|
|
2601
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
2602
|
+
return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_halt",[]);
|
|
2603
|
+
}),(smalltalk.Error || Error)]);
|
|
2604
|
+
return self},
|
|
2605
|
+
args: [],
|
|
2606
|
+
source: "testHalt\x0a\x09self should: [Object new halt] raise: Error",
|
|
2607
|
+
messageSends: ["should:raise:", "halt", "new"],
|
|
2608
|
+
referencedClasses: ["Object", "Error"]
|
|
2609
|
+
}),
|
|
2610
|
+
smalltalk.ObjectTest);
|
|
2611
|
+
|
|
2612
|
+
smalltalk.addMethod(
|
|
2613
|
+
"_testIdentity",
|
|
2614
|
+
smalltalk.method({
|
|
2615
|
+
selector: "testIdentity",
|
|
2616
|
+
category: 'tests',
|
|
2617
|
+
fn: function (){
|
|
2618
|
+
var self=this;
|
|
2619
|
+
var o;
|
|
2620
|
+
o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2621
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq_eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
|
|
2622
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[o])]);
|
|
2623
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq_eq",[o])]);
|
|
2624
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[smalltalk.send(o,"_yourself",[])])]);
|
|
2625
|
+
return self},
|
|
2626
|
+
args: [],
|
|
2627
|
+
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",
|
|
2628
|
+
messageSends: ["new", "deny:", "==", "assert:", "yourself"],
|
|
2629
|
+
referencedClasses: ["Object"]
|
|
2630
|
+
}),
|
|
2631
|
+
smalltalk.ObjectTest);
|
|
2632
|
+
|
|
2633
|
+
smalltalk.addMethod(
|
|
2634
|
+
"_testIfNil",
|
|
2635
|
+
smalltalk.method({
|
|
2636
|
+
selector: "testIfNil",
|
|
2637
|
+
category: 'tests',
|
|
2638
|
+
fn: function (){
|
|
2639
|
+
var self=this;
|
|
2640
|
+
var $2,$1,$4,$3,$6,$5;
|
|
2641
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_isNil",[])]);
|
|
2642
|
+
$2=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2643
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
|
2644
|
+
$1=true;
|
|
2645
|
+
} else {
|
|
2646
|
+
$1=$2;
|
|
2647
|
+
};
|
|
2648
|
+
smalltalk.send(self,"_deny_",[smalltalk.send($1,"__eq",[true])]);
|
|
2649
|
+
$4=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2650
|
+
if(($receiver = $4) == nil || $receiver == undefined){
|
|
2651
|
+
$3=$4;
|
|
2652
|
+
} else {
|
|
2653
|
+
$3=true;
|
|
2654
|
+
};
|
|
2655
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[true])]);
|
|
2656
|
+
$6=smalltalk.send((smalltalk.Object || Object),"_new",[]);
|
|
2657
|
+
if(($receiver = $6) == nil || $receiver == undefined){
|
|
2658
|
+
$5=false;
|
|
2659
|
+
} else {
|
|
2660
|
+
$5=true;
|
|
2661
|
+
};
|
|
2662
|
+
smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",[true])]);
|
|
2663
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_ifNotNil_ifNil_",[(function(){
|
|
2664
|
+
return true;
|
|
2665
|
+
}),(function(){
|
|
2666
|
+
return false;
|
|
2667
|
+
})]),"__eq",[true])]);
|
|
2668
|
+
return self},
|
|
2669
|
+
args: [],
|
|
2670
|
+
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",
|
|
2671
|
+
messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
|
|
2672
|
+
referencedClasses: ["Object"]
|
|
2673
|
+
}),
|
|
2674
|
+
smalltalk.ObjectTest);
|
|
2675
|
+
|
|
2676
|
+
smalltalk.addMethod(
|
|
2677
|
+
"_testInstVars",
|
|
2678
|
+
smalltalk.method({
|
|
2679
|
+
selector: "testInstVars",
|
|
2680
|
+
category: 'tests',
|
|
2681
|
+
fn: function (){
|
|
2682
|
+
var self=this;
|
|
2683
|
+
var o;
|
|
2684
|
+
o=smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_new",[]);
|
|
2685
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),nil]);
|
|
2686
|
+
smalltalk.send(o,"_instVarAt_put_",[smalltalk.symbolFor("foo"),(1)]);
|
|
2687
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),(1)]);
|
|
2688
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",["foo"]),(1)]);
|
|
2689
|
+
return self},
|
|
2690
|
+
args: [],
|
|
2691
|
+
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",
|
|
2692
|
+
messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
|
|
2693
|
+
referencedClasses: ["ObjectMock"]
|
|
2694
|
+
}),
|
|
2695
|
+
smalltalk.ObjectTest);
|
|
2696
|
+
|
|
2697
|
+
smalltalk.addMethod(
|
|
2698
|
+
"_testNilUndefined",
|
|
2699
|
+
smalltalk.method({
|
|
2700
|
+
selector: "testNilUndefined",
|
|
2701
|
+
category: 'tests',
|
|
2702
|
+
fn: function (){
|
|
2703
|
+
var self=this;
|
|
2704
|
+
var notDefined;
|
|
2705
|
+
notDefined = undefined;
|
|
2706
|
+
;
|
|
2707
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(nil,"__eq",[notDefined])]);
|
|
2708
|
+
return self},
|
|
2709
|
+
args: [],
|
|
2710
|
+
source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09| notDefined |\x0a \x0a <notDefined = undefined>.\x0a\x0a\x09self assert: nil = notDefined",
|
|
2711
|
+
messageSends: ["assert:", "="],
|
|
2712
|
+
referencedClasses: []
|
|
2713
|
+
}),
|
|
2714
|
+
smalltalk.ObjectTest);
|
|
2715
|
+
|
|
2716
|
+
smalltalk.addMethod(
|
|
2717
|
+
"_testYourself",
|
|
2718
|
+
smalltalk.method({
|
|
2719
|
+
selector: "testYourself",
|
|
2720
|
+
category: 'tests',
|
|
2721
|
+
fn: function () {
|
|
2722
|
+
var self = this;
|
|
2723
|
+
var o;
|
|
2724
|
+
o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
|
|
2725
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
|
|
2726
|
+
return self;
|
|
2727
|
+
},
|
|
2728
|
+
args: [],
|
|
2729
|
+
source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
|
|
2730
|
+
messageSends: ["new", "assert:", "==", "yourself"],
|
|
2731
|
+
referencedClasses: ["ObjectMock"]
|
|
2732
|
+
}),
|
|
2733
|
+
smalltalk.ObjectTest);
|
|
2734
|
+
|
|
2735
|
+
smalltalk.addMethod(
|
|
2736
|
+
"_testidentityHash",
|
|
2737
|
+
smalltalk.method({
|
|
2738
|
+
selector: "testidentityHash",
|
|
2739
|
+
category: 'tests',
|
|
2740
|
+
fn: function () {
|
|
2741
|
+
var self = this;
|
|
2742
|
+
var o1;
|
|
2743
|
+
var o2;
|
|
2744
|
+
o1 = smalltalk.send(smalltalk.Object || Object, "_new", []);
|
|
2745
|
+
o2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
|
|
2746
|
+
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
|
|
2747
|
+
smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
|
|
2748
|
+
return self;
|
|
2749
|
+
},
|
|
2750
|
+
args: [],
|
|
2751
|
+
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",
|
|
2752
|
+
messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
|
|
2753
|
+
referencedClasses: ["Object"]
|
|
2754
|
+
}),
|
|
2755
|
+
smalltalk.ObjectTest);
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
|
|
2760
|
+
smalltalk.addMethod(
|
|
2761
|
+
"_setUp",
|
|
2762
|
+
smalltalk.method({
|
|
2763
|
+
selector: "setUp",
|
|
2764
|
+
category: 'running',
|
|
2765
|
+
fn: function (){
|
|
2766
|
+
var self=this;
|
|
2767
|
+
var $1,$2;
|
|
2768
|
+
self["@backUpCommitPathJs"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs",[]);
|
|
2769
|
+
self["@backUpCommitPathSt"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt",[]);
|
|
2770
|
+
smalltalk.send((smalltalk.Package || Package),"_resetCommitPaths",[]);
|
|
2771
|
+
self["@zorkPackage"]=smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_new",[]),"_name_",["Zork"]);
|
|
2772
|
+
$1=smalltalk.send((smalltalk.Package || Package),"_new",[]);
|
|
2773
|
+
smalltalk.send($1,"_name_",["Grul"]);
|
|
2774
|
+
smalltalk.send($1,"_commitPathJs_",["server/grul/js"]);
|
|
2775
|
+
smalltalk.send($1,"_commitPathSt_",["grul/st"]);
|
|
2776
|
+
$2=smalltalk.send($1,"_yourself",[]);
|
|
2777
|
+
self["@grulPackage"]=$2;
|
|
2778
|
+
return self},
|
|
2779
|
+
args: [],
|
|
2780
|
+
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",
|
|
2781
|
+
messageSends: ["defaultCommitPathJs", "defaultCommitPathSt", "resetCommitPaths", "name:", "new", "commitPathJs:", "commitPathSt:", "yourself"],
|
|
2782
|
+
referencedClasses: ["Package"]
|
|
2783
|
+
}),
|
|
2784
|
+
smalltalk.PackageTest);
|
|
2785
|
+
|
|
2786
|
+
smalltalk.addMethod(
|
|
2787
|
+
"_tearDown",
|
|
2788
|
+
smalltalk.method({
|
|
2789
|
+
selector: "tearDown",
|
|
2790
|
+
category: 'running',
|
|
2791
|
+
fn: function (){
|
|
2792
|
+
var self=this;
|
|
2793
|
+
var $1;
|
|
2794
|
+
smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",[self["@backUpCommitPathJs"]]);
|
|
2795
|
+
$1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",[self["@backUpCommitPathSt"]]);
|
|
2796
|
+
return self},
|
|
1687
2797
|
args: [],
|
|
1688
|
-
source: "
|
|
1689
|
-
messageSends: ["
|
|
1690
|
-
referencedClasses: ["
|
|
2798
|
+
source: "tearDown\x0a\x09 Package \x0a\x09\x09defaultCommitPathJs: backUpCommitPathJs;\x0a\x09\x09defaultCommitPathSt: backUpCommitPathSt",
|
|
2799
|
+
messageSends: ["defaultCommitPathJs:", "defaultCommitPathSt:"],
|
|
2800
|
+
referencedClasses: ["Package"]
|
|
1691
2801
|
}),
|
|
1692
|
-
smalltalk.
|
|
2802
|
+
smalltalk.PackageTest);
|
|
1693
2803
|
|
|
1694
2804
|
smalltalk.addMethod(
|
|
1695
|
-
"
|
|
2805
|
+
"_testGrulCommitPathJsShouldBeServerGrulJs",
|
|
1696
2806
|
smalltalk.method({
|
|
1697
|
-
selector: "
|
|
2807
|
+
selector: "testGrulCommitPathJsShouldBeServerGrulJs",
|
|
1698
2808
|
category: 'tests',
|
|
1699
2809
|
fn: function (){
|
|
1700
2810
|
var self=this;
|
|
1701
|
-
smalltalk.send(self,
|
|
1702
|
-
return self
|
|
2811
|
+
smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
|
|
2812
|
+
return self},
|
|
1703
2813
|
args: [],
|
|
1704
|
-
source: "
|
|
1705
|
-
messageSends: ["assert:", "
|
|
2814
|
+
source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
|
|
2815
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
|
1706
2816
|
referencedClasses: []
|
|
1707
2817
|
}),
|
|
1708
|
-
smalltalk.
|
|
2818
|
+
smalltalk.PackageTest);
|
|
1709
2819
|
|
|
1710
2820
|
smalltalk.addMethod(
|
|
1711
|
-
"
|
|
2821
|
+
"_testGrulCommitPathStShouldBeGrulSt",
|
|
1712
2822
|
smalltalk.method({
|
|
1713
|
-
selector: "
|
|
2823
|
+
selector: "testGrulCommitPathStShouldBeGrulSt",
|
|
1714
2824
|
category: 'tests',
|
|
1715
2825
|
fn: function (){
|
|
1716
2826
|
var self=this;
|
|
1717
|
-
smalltalk.send(self,
|
|
1718
|
-
|
|
1719
|
-
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
|
|
1720
|
-
return self;},
|
|
2827
|
+
smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
|
|
2828
|
+
return self},
|
|
1721
2829
|
args: [],
|
|
1722
|
-
source: "
|
|
1723
|
-
messageSends: ["assert:
|
|
2830
|
+
source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
|
|
2831
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
|
1724
2832
|
referencedClasses: []
|
|
1725
2833
|
}),
|
|
1726
|
-
smalltalk.
|
|
2834
|
+
smalltalk.PackageTest);
|
|
1727
2835
|
|
|
1728
2836
|
smalltalk.addMethod(
|
|
1729
|
-
"
|
|
2837
|
+
"_testZorkCommitPathJsShouldBeJs",
|
|
1730
2838
|
smalltalk.method({
|
|
1731
|
-
selector: "
|
|
2839
|
+
selector: "testZorkCommitPathJsShouldBeJs",
|
|
1732
2840
|
category: 'tests',
|
|
1733
2841
|
fn: function (){
|
|
1734
2842
|
var self=this;
|
|
1735
|
-
smalltalk.send(self,
|
|
1736
|
-
return self
|
|
2843
|
+
smalltalk.send(self,"_assert_equals_",["js",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
|
|
2844
|
+
return self},
|
|
1737
2845
|
args: [],
|
|
1738
|
-
source: "
|
|
1739
|
-
messageSends: ["
|
|
1740
|
-
referencedClasses: [
|
|
2846
|
+
source: "testZorkCommitPathJsShouldBeJs\x0a\x09self assert: 'js' equals: zorkPackage commitPathJs",
|
|
2847
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
|
2848
|
+
referencedClasses: []
|
|
1741
2849
|
}),
|
|
1742
|
-
smalltalk.
|
|
2850
|
+
smalltalk.PackageTest);
|
|
1743
2851
|
|
|
1744
2852
|
smalltalk.addMethod(
|
|
1745
|
-
"
|
|
2853
|
+
"_testZorkCommitPathStShouldBeSt",
|
|
1746
2854
|
smalltalk.method({
|
|
1747
|
-
selector: "
|
|
2855
|
+
selector: "testZorkCommitPathStShouldBeSt",
|
|
1748
2856
|
category: 'tests',
|
|
1749
2857
|
fn: function (){
|
|
1750
2858
|
var self=this;
|
|
1751
|
-
smalltalk.send(self,
|
|
1752
|
-
return self
|
|
2859
|
+
smalltalk.send(self,"_assert_equals_",["st",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
|
|
2860
|
+
return self},
|
|
1753
2861
|
args: [],
|
|
1754
|
-
source: "
|
|
1755
|
-
messageSends: ["assert:equals:", "
|
|
2862
|
+
source: "testZorkCommitPathStShouldBeSt\x0a\x09self assert: 'st' equals: zorkPackage commitPathSt",
|
|
2863
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
|
1756
2864
|
referencedClasses: []
|
|
1757
2865
|
}),
|
|
1758
|
-
smalltalk.
|
|
2866
|
+
smalltalk.PackageTest);
|
|
1759
2867
|
|
|
2868
|
+
|
|
2869
|
+
|
|
2870
|
+
smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
|
|
1760
2871
|
smalltalk.addMethod(
|
|
1761
|
-
"
|
|
2872
|
+
"_setUp",
|
|
1762
2873
|
smalltalk.method({
|
|
1763
|
-
selector: "
|
|
1764
|
-
category: '
|
|
2874
|
+
selector: "setUp",
|
|
2875
|
+
category: 'running',
|
|
1765
2876
|
fn: function (){
|
|
1766
2877
|
var self=this;
|
|
1767
|
-
|
|
1768
|
-
smalltalk.send(self,
|
|
1769
|
-
smalltalk.send(
|
|
1770
|
-
smalltalk.send(
|
|
1771
|
-
|
|
1772
|
-
return self;},
|
|
2878
|
+
var $1;
|
|
2879
|
+
smalltalk.send(self,"_setUp",[],smalltalk.PackageTest);
|
|
2880
|
+
smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",["javascripts/"]);
|
|
2881
|
+
$1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",["smalltalk/"]);
|
|
2882
|
+
return self},
|
|
1773
2883
|
args: [],
|
|
1774
|
-
source: "
|
|
1775
|
-
messageSends: ["
|
|
1776
|
-
referencedClasses: []
|
|
2884
|
+
source: "setUp\x0a\x09super setUp.\x0a\x0a\x09Package\x0a\x09\x09defaultCommitPathJs: 'javascripts/';\x0a\x09\x09defaultCommitPathSt: 'smalltalk/'.",
|
|
2885
|
+
messageSends: ["setUp", "defaultCommitPathJs:", "defaultCommitPathSt:"],
|
|
2886
|
+
referencedClasses: ["Package"]
|
|
1777
2887
|
}),
|
|
1778
|
-
smalltalk.
|
|
2888
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
|
1779
2889
|
|
|
1780
2890
|
smalltalk.addMethod(
|
|
1781
|
-
"
|
|
2891
|
+
"_testGrulCommitPathJsShouldBeServerGrulJs",
|
|
1782
2892
|
smalltalk.method({
|
|
1783
|
-
selector: "
|
|
2893
|
+
selector: "testGrulCommitPathJsShouldBeServerGrulJs",
|
|
1784
2894
|
category: 'tests',
|
|
1785
2895
|
fn: function (){
|
|
1786
2896
|
var self=this;
|
|
1787
|
-
smalltalk.send(self,
|
|
1788
|
-
|
|
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)])]);
|
|
1792
|
-
return self;},
|
|
2897
|
+
smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
|
|
2898
|
+
return self},
|
|
1793
2899
|
args: [],
|
|
1794
|
-
source: "
|
|
1795
|
-
messageSends: ["assert:
|
|
2900
|
+
source: "testGrulCommitPathJsShouldBeServerGrulJs\x0a\x09self assert: 'server/grul/js' equals: grulPackage commitPathJs",
|
|
2901
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
|
1796
2902
|
referencedClasses: []
|
|
1797
2903
|
}),
|
|
1798
|
-
smalltalk.
|
|
2904
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
|
1799
2905
|
|
|
1800
2906
|
smalltalk.addMethod(
|
|
1801
|
-
"
|
|
2907
|
+
"_testGrulCommitPathStShouldBeGrulSt",
|
|
1802
2908
|
smalltalk.method({
|
|
1803
|
-
selector: "
|
|
2909
|
+
selector: "testGrulCommitPathStShouldBeGrulSt",
|
|
1804
2910
|
category: 'tests',
|
|
1805
2911
|
fn: function (){
|
|
1806
2912
|
var self=this;
|
|
1807
|
-
smalltalk.send(self,
|
|
1808
|
-
|
|
1809
|
-
return self;},
|
|
2913
|
+
smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
|
|
2914
|
+
return self},
|
|
1810
2915
|
args: [],
|
|
1811
|
-
source: "
|
|
1812
|
-
messageSends: ["assert:
|
|
2916
|
+
source: "testGrulCommitPathStShouldBeGrulSt\x0a\x09self assert: 'grul/st' equals: grulPackage commitPathSt",
|
|
2917
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
|
1813
2918
|
referencedClasses: []
|
|
1814
2919
|
}),
|
|
1815
|
-
smalltalk.
|
|
2920
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
|
1816
2921
|
|
|
1817
2922
|
smalltalk.addMethod(
|
|
1818
|
-
"
|
|
2923
|
+
"_testZorkCommitPathJsShouldBeJavascript",
|
|
1819
2924
|
smalltalk.method({
|
|
1820
|
-
selector: "
|
|
2925
|
+
selector: "testZorkCommitPathJsShouldBeJavascript",
|
|
1821
2926
|
category: 'tests',
|
|
1822
2927
|
fn: function (){
|
|
1823
2928
|
var self=this;
|
|
1824
|
-
smalltalk.send(self,
|
|
1825
|
-
return self
|
|
2929
|
+
smalltalk.send(self,"_assert_equals_",["javascripts/",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
|
|
2930
|
+
return self},
|
|
1826
2931
|
args: [],
|
|
1827
|
-
source: "
|
|
1828
|
-
messageSends: ["assert:equals:", "
|
|
2932
|
+
source: "testZorkCommitPathJsShouldBeJavascript\x0a\x09self assert: 'javascripts/' equals: zorkPackage commitPathJs",
|
|
2933
|
+
messageSends: ["assert:equals:", "commitPathJs"],
|
|
1829
2934
|
referencedClasses: []
|
|
1830
2935
|
}),
|
|
1831
|
-
smalltalk.
|
|
2936
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
|
1832
2937
|
|
|
1833
2938
|
smalltalk.addMethod(
|
|
1834
|
-
"
|
|
2939
|
+
"_testZorkCommitPathStShouldBeSmalltalk",
|
|
1835
2940
|
smalltalk.method({
|
|
1836
|
-
selector: "
|
|
2941
|
+
selector: "testZorkCommitPathStShouldBeSmalltalk",
|
|
1837
2942
|
category: 'tests',
|
|
1838
2943
|
fn: function (){
|
|
1839
2944
|
var self=this;
|
|
1840
|
-
smalltalk.send(self,
|
|
1841
|
-
|
|
1842
|
-
return self;},
|
|
2945
|
+
smalltalk.send(self,"_assert_equals_",["smalltalk/",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
|
|
2946
|
+
return self},
|
|
1843
2947
|
args: [],
|
|
1844
|
-
source: "
|
|
1845
|
-
messageSends: ["assert:equals:", "
|
|
2948
|
+
source: "testZorkCommitPathStShouldBeSmalltalk\x0a\x09self assert: 'smalltalk/' equals: zorkPackage commitPathSt",
|
|
2949
|
+
messageSends: ["assert:equals:", "commitPathSt"],
|
|
1846
2950
|
referencedClasses: []
|
|
1847
2951
|
}),
|
|
1848
|
-
smalltalk.
|
|
2952
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest);
|
|
2953
|
+
|
|
1849
2954
|
|
|
1850
2955
|
smalltalk.addMethod(
|
|
1851
|
-
"
|
|
2956
|
+
"_shouldInheritSelectors",
|
|
1852
2957
|
smalltalk.method({
|
|
1853
|
-
selector: "
|
|
1854
|
-
category: '
|
|
2958
|
+
selector: "shouldInheritSelectors",
|
|
2959
|
+
category: 'accessing',
|
|
1855
2960
|
fn: function (){
|
|
1856
2961
|
var self=this;
|
|
1857
|
-
|
|
1858
|
-
|
|
2962
|
+
return false;
|
|
2963
|
+
},
|
|
1859
2964
|
args: [],
|
|
1860
|
-
source: "
|
|
1861
|
-
messageSends: [
|
|
1862
|
-
referencedClasses: [
|
|
2965
|
+
source: "shouldInheritSelectors\x0a\x09^ false",
|
|
2966
|
+
messageSends: [],
|
|
2967
|
+
referencedClasses: []
|
|
1863
2968
|
}),
|
|
1864
|
-
smalltalk.
|
|
1865
|
-
|
|
2969
|
+
smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
|
|
1866
2970
|
|
|
1867
2971
|
|
|
1868
|
-
smalltalk.addClass('
|
|
2972
|
+
smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1869
2973
|
smalltalk.addMethod(
|
|
1870
|
-
"
|
|
2974
|
+
"_testAccessing",
|
|
1871
2975
|
smalltalk.method({
|
|
1872
|
-
selector: "
|
|
2976
|
+
selector: "testAccessing",
|
|
1873
2977
|
category: 'tests',
|
|
1874
2978
|
fn: function (){
|
|
1875
2979
|
var self=this;
|
|
1876
|
-
smalltalk.send(self,
|
|
1877
|
-
|
|
2980
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_x",[]),(3)]);
|
|
2981
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_y",[]),(4)]);
|
|
2982
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_x_",[(3)]),"_x",[]),(3)]);
|
|
2983
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_y_",[(4)]),"_y",[]),(4)]);
|
|
2984
|
+
return self},
|
|
1878
2985
|
args: [],
|
|
1879
|
-
source: "
|
|
1880
|
-
messageSends: ["assert:equals:", "
|
|
1881
|
-
referencedClasses: []
|
|
2986
|
+
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",
|
|
2987
|
+
messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
|
|
2988
|
+
referencedClasses: ["Point"]
|
|
1882
2989
|
}),
|
|
1883
|
-
smalltalk.
|
|
2990
|
+
smalltalk.PointTest);
|
|
1884
2991
|
|
|
1885
2992
|
smalltalk.addMethod(
|
|
1886
|
-
"
|
|
2993
|
+
"_testArithmetic",
|
|
1887
2994
|
smalltalk.method({
|
|
1888
|
-
selector: "
|
|
2995
|
+
selector: "testArithmetic",
|
|
1889
2996
|
category: 'tests',
|
|
1890
2997
|
fn: function (){
|
|
1891
2998
|
var self=this;
|
|
1892
|
-
smalltalk.send(self,
|
|
1893
|
-
|
|
2999
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__star",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(9),(16)])]);
|
|
3000
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__plus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(6),(8)])]);
|
|
3001
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__minus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(0),(0)])]);
|
|
3002
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((6),"__at",[(8)]),"__slash",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(2),(2)])]);
|
|
3003
|
+
return self},
|
|
1894
3004
|
args: [],
|
|
1895
|
-
source: "
|
|
1896
|
-
messageSends: ["assert:", "
|
|
1897
|
-
referencedClasses: []
|
|
3005
|
+
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)",
|
|
3006
|
+
messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
|
|
3007
|
+
referencedClasses: ["Point"]
|
|
1898
3008
|
}),
|
|
1899
|
-
smalltalk.
|
|
3009
|
+
smalltalk.PointTest);
|
|
1900
3010
|
|
|
1901
3011
|
smalltalk.addMethod(
|
|
1902
3012
|
"_testAt",
|
|
@@ -1905,131 +3015,154 @@ selector: "testAt",
|
|
|
1905
3015
|
category: 'tests',
|
|
1906
3016
|
fn: function (){
|
|
1907
3017
|
var self=this;
|
|
1908
|
-
smalltalk.send(self,
|
|
1909
|
-
|
|
1910
|
-
smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
|
|
1911
|
-
return self;},
|
|
3018
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)])]);
|
|
3019
|
+
return self},
|
|
1912
3020
|
args: [],
|
|
1913
|
-
source: "testAt\x0a\x09self assert:
|
|
1914
|
-
messageSends: ["assert:", "
|
|
1915
|
-
referencedClasses: []
|
|
3021
|
+
source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
|
|
3022
|
+
messageSends: ["assert:equals:", "@", "x:y:"],
|
|
3023
|
+
referencedClasses: ["Point"]
|
|
1916
3024
|
}),
|
|
1917
|
-
smalltalk.
|
|
3025
|
+
smalltalk.PointTest);
|
|
1918
3026
|
|
|
1919
3027
|
smalltalk.addMethod(
|
|
1920
|
-
"
|
|
3028
|
+
"_testEgality",
|
|
1921
3029
|
smalltalk.method({
|
|
1922
|
-
selector: "
|
|
3030
|
+
selector: "testEgality",
|
|
1923
3031
|
category: 'tests',
|
|
1924
3032
|
fn: function (){
|
|
1925
3033
|
var self=this;
|
|
1926
|
-
smalltalk.send(self,
|
|
1927
|
-
|
|
3034
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__eq",[smalltalk.send((3),"__at",[(4)])])]);
|
|
3035
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((3),"__at",[(5)]),"__eq",[smalltalk.send((3),"__at",[(6)])])]);
|
|
3036
|
+
return self},
|
|
1928
3037
|
args: [],
|
|
1929
|
-
source: "
|
|
1930
|
-
messageSends: ["
|
|
1931
|
-
referencedClasses: [
|
|
3038
|
+
source: "testEgality\x0a\x09self assert: 3@4 = (3@4).\x0a\x09self deny: 3@5 = (3@6)",
|
|
3039
|
+
messageSends: ["assert:", "=", "@", "deny:"],
|
|
3040
|
+
referencedClasses: []
|
|
1932
3041
|
}),
|
|
1933
|
-
smalltalk.
|
|
3042
|
+
smalltalk.PointTest);
|
|
1934
3043
|
|
|
1935
3044
|
smalltalk.addMethod(
|
|
1936
|
-
"
|
|
3045
|
+
"_testTranslateBy",
|
|
1937
3046
|
smalltalk.method({
|
|
1938
|
-
selector: "
|
|
3047
|
+
selector: "testTranslateBy",
|
|
1939
3048
|
category: 'tests',
|
|
1940
3049
|
fn: function (){
|
|
1941
3050
|
var self=this;
|
|
1942
|
-
smalltalk.send(self,
|
|
1943
|
-
smalltalk.send(self,
|
|
1944
|
-
smalltalk.send(self,
|
|
1945
|
-
smalltalk.send(self,
|
|
1946
|
-
|
|
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")]))]);
|
|
1950
|
-
return self;},
|
|
3051
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((0),"__at",[(1)])])]);
|
|
3052
|
+
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",[])])])]);
|
|
3053
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send((5),"__at",[(6)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((2),"__at",[(3)])])]);
|
|
3054
|
+
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)])])]);
|
|
3055
|
+
return self},
|
|
1951
3056
|
args: [],
|
|
1952
|
-
source: "
|
|
1953
|
-
messageSends: ["assert:", "
|
|
3057
|
+
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).",
|
|
3058
|
+
messageSends: ["assert:equals:", "@", "translateBy:", "negated"],
|
|
1954
3059
|
referencedClasses: []
|
|
1955
3060
|
}),
|
|
1956
|
-
smalltalk.
|
|
3061
|
+
smalltalk.PointTest);
|
|
1957
3062
|
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1958
3066
|
smalltalk.addMethod(
|
|
1959
|
-
"
|
|
3067
|
+
"_textNext",
|
|
1960
3068
|
smalltalk.method({
|
|
1961
|
-
selector: "
|
|
3069
|
+
selector: "textNext",
|
|
1962
3070
|
category: 'tests',
|
|
1963
3071
|
fn: function (){
|
|
1964
3072
|
var self=this;
|
|
1965
|
-
smalltalk.send(
|
|
1966
|
-
|
|
1967
|
-
|
|
3073
|
+
smalltalk.send((10000),"_timesRepeat_",[(function(){
|
|
3074
|
+
var current;
|
|
3075
|
+
var next;
|
|
3076
|
+
next=smalltalk.send(smalltalk.send((smalltalk.Random || Random),"_new",[]),"_next",[]);
|
|
3077
|
+
next;
|
|
3078
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(next,"__gt_eq",[(0)])]);
|
|
3079
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(next,"__lt",[(1)])]);
|
|
3080
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(current,"__eq",[next])]);
|
|
3081
|
+
return smalltalk.send(next,"__eq",[current]);
|
|
3082
|
+
})]);
|
|
3083
|
+
return self},
|
|
1968
3084
|
args: [],
|
|
1969
|
-
source: "
|
|
1970
|
-
messageSends: ["assert:", "
|
|
1971
|
-
referencedClasses: []
|
|
3085
|
+
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]",
|
|
3086
|
+
messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
|
|
3087
|
+
referencedClasses: ["Random"]
|
|
1972
3088
|
}),
|
|
1973
|
-
smalltalk.
|
|
3089
|
+
smalltalk.RandomTest);
|
|
3090
|
+
|
|
1974
3091
|
|
|
3092
|
+
|
|
3093
|
+
smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
1975
3094
|
smalltalk.addMethod(
|
|
1976
|
-
"
|
|
3095
|
+
"_testAddRemove",
|
|
1977
3096
|
smalltalk.method({
|
|
1978
|
-
selector: "
|
|
3097
|
+
selector: "testAddRemove",
|
|
1979
3098
|
category: 'tests',
|
|
1980
3099
|
fn: function (){
|
|
1981
3100
|
var self=this;
|
|
1982
|
-
|
|
1983
|
-
smalltalk.send(
|
|
1984
|
-
smalltalk.send(self,
|
|
1985
|
-
smalltalk.send(
|
|
1986
|
-
smalltalk.send(self,
|
|
1987
|
-
smalltalk.send(
|
|
1988
|
-
|
|
3101
|
+
var set;
|
|
3102
|
+
set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
|
|
3103
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(set,"_isEmpty",[])]);
|
|
3104
|
+
smalltalk.send(set,"_add_",[(3)]);
|
|
3105
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(3)])]);
|
|
3106
|
+
smalltalk.send(set,"_add_",[(5)]);
|
|
3107
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(5)])]);
|
|
3108
|
+
smalltalk.send(set,"_remove_",[(3)]);
|
|
3109
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(set,"_includes_",[(3)])]);
|
|
3110
|
+
return self},
|
|
1989
3111
|
args: [],
|
|
1990
|
-
source: "
|
|
1991
|
-
messageSends: ["assert:", "
|
|
1992
|
-
referencedClasses: []
|
|
3112
|
+
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)",
|
|
3113
|
+
messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
|
|
3114
|
+
referencedClasses: ["Set"]
|
|
1993
3115
|
}),
|
|
1994
|
-
smalltalk.
|
|
3116
|
+
smalltalk.SetTest);
|
|
1995
3117
|
|
|
1996
3118
|
smalltalk.addMethod(
|
|
1997
|
-
"
|
|
3119
|
+
"_testAt",
|
|
1998
3120
|
smalltalk.method({
|
|
1999
|
-
selector: "
|
|
3121
|
+
selector: "testAt",
|
|
2000
3122
|
category: 'tests',
|
|
2001
3123
|
fn: function (){
|
|
2002
3124
|
var self=this;
|
|
2003
|
-
smalltalk.send(self,
|
|
2004
|
-
smalltalk.send(
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
return self;},
|
|
3125
|
+
smalltalk.send(self,"_should_raise_",[(function(){
|
|
3126
|
+
return smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_at_put_",[(1),(2)]);
|
|
3127
|
+
}),(smalltalk.Error || Error)]);
|
|
3128
|
+
return self},
|
|
2008
3129
|
args: [],
|
|
2009
|
-
source: "
|
|
2010
|
-
messageSends: ["
|
|
2011
|
-
referencedClasses: []
|
|
3130
|
+
source: "testAt\x0a\x09self should: [Set new at: 1 put: 2] raise: Error",
|
|
3131
|
+
messageSends: ["should:raise:", "at:put:", "new"],
|
|
3132
|
+
referencedClasses: ["Set", "Error"]
|
|
2012
3133
|
}),
|
|
2013
|
-
smalltalk.
|
|
3134
|
+
smalltalk.SetTest);
|
|
2014
3135
|
|
|
2015
3136
|
smalltalk.addMethod(
|
|
2016
|
-
"
|
|
3137
|
+
"_testPrintString",
|
|
2017
3138
|
smalltalk.method({
|
|
2018
|
-
selector: "
|
|
3139
|
+
selector: "testPrintString",
|
|
2019
3140
|
category: 'tests',
|
|
2020
3141
|
fn: function (){
|
|
2021
3142
|
var self=this;
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
smalltalk.send(
|
|
2025
|
-
smalltalk.send(self,
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
3143
|
+
var $1,$2;
|
|
3144
|
+
var set;
|
|
3145
|
+
set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
|
|
3146
|
+
smalltalk.send(self,"_assert_equals_",["a Set ()",smalltalk.send(set,"_printString",[])]);
|
|
3147
|
+
smalltalk.send(set,"_add_",[(1)]);
|
|
3148
|
+
$1=smalltalk.send(set,"_add_",[(3)]);
|
|
3149
|
+
smalltalk.send(self,"_assert_equals_",["a Set (1 3)",smalltalk.send(set,"_printString",[])]);
|
|
3150
|
+
smalltalk.send(set,"_add_",["foo"]);
|
|
3151
|
+
smalltalk.send(self,"_assert_equals_",["a Set (1 3 'foo')",smalltalk.send(set,"_printString",[])]);
|
|
3152
|
+
smalltalk.send(set,"_remove_",[(1)]);
|
|
3153
|
+
$2=smalltalk.send(set,"_remove_",[(3)]);
|
|
3154
|
+
smalltalk.send(self,"_assert_equals_",["a Set ('foo')",smalltalk.send(set,"_printString",[])]);
|
|
3155
|
+
smalltalk.send(set,"_add_",[(3)]);
|
|
3156
|
+
smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
|
|
3157
|
+
smalltalk.send(set,"_add_",[(3)]);
|
|
3158
|
+
smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
|
|
3159
|
+
return self},
|
|
3160
|
+
args: [],
|
|
3161
|
+
source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: 'a Set ()' equals: ( set printString ).\x0a\x09set add: 1; add: 3.\x0a\x09self assert: 'a Set (1 3)' equals: ( set printString ).\x0a\x09set add: 'foo'.\x0a\x09self assert: 'a Set (1 3 ''foo'')' equals: ( set printString ).\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: 'a Set (''foo'')' equals: ( set printString ).\x0a\x09set add: 3.\x0a\x09self assert: 'a Set (''foo'' 3)' equals: ( set printString ).\x0a\x09set add: 3.\x0a\x09self assert: 'a Set (''foo'' 3)' equals: ( set printString ).",
|
|
3162
|
+
messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
|
|
3163
|
+
referencedClasses: ["Set"]
|
|
2031
3164
|
}),
|
|
2032
|
-
smalltalk.
|
|
3165
|
+
smalltalk.SetTest);
|
|
2033
3166
|
|
|
2034
3167
|
smalltalk.addMethod(
|
|
2035
3168
|
"_testSize",
|
|
@@ -2038,15 +3171,40 @@ selector: "testSize",
|
|
|
2038
3171
|
category: 'tests',
|
|
2039
3172
|
fn: function (){
|
|
2040
3173
|
var self=this;
|
|
2041
|
-
smalltalk.send(self,
|
|
2042
|
-
smalltalk.send(self,
|
|
2043
|
-
|
|
3174
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_size",[]),(0)]);
|
|
3175
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (2), (3), (4)]]),"_size",[]),(4)]);
|
|
3176
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (1), (1), (1)]]),"_size",[]),(1)]);
|
|
3177
|
+
return self},
|
|
2044
3178
|
args: [],
|
|
2045
|
-
source: "testSize\x0a\x09self assert: #
|
|
2046
|
-
messageSends: ["assert:equals:", "size"],
|
|
2047
|
-
referencedClasses: []
|
|
3179
|
+
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",
|
|
3180
|
+
messageSends: ["assert:equals:", "size", "new", "withAll:"],
|
|
3181
|
+
referencedClasses: ["Set"]
|
|
2048
3182
|
}),
|
|
2049
|
-
smalltalk.
|
|
3183
|
+
smalltalk.SetTest);
|
|
3184
|
+
|
|
3185
|
+
smalltalk.addMethod(
|
|
3186
|
+
"_testUnicity",
|
|
3187
|
+
smalltalk.method({
|
|
3188
|
+
selector: "testUnicity",
|
|
3189
|
+
category: 'tests',
|
|
3190
|
+
fn: function (){
|
|
3191
|
+
var self=this;
|
|
3192
|
+
var set;
|
|
3193
|
+
set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
|
|
3194
|
+
smalltalk.send(set,"_add_",[(21)]);
|
|
3195
|
+
smalltalk.send(set,"_add_",["hello"]);
|
|
3196
|
+
smalltalk.send(set,"_add_",[(21)]);
|
|
3197
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
|
|
3198
|
+
smalltalk.send(set,"_add_",["hello"]);
|
|
3199
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
|
|
3200
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(set,"_asArray",[]),[(21), "hello"]]);
|
|
3201
|
+
return self},
|
|
3202
|
+
args: [],
|
|
3203
|
+
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')",
|
|
3204
|
+
messageSends: ["new", "add:", "assert:", "=", "size", "assert:equals:", "asArray"],
|
|
3205
|
+
referencedClasses: ["Set"]
|
|
3206
|
+
}),
|
|
3207
|
+
smalltalk.SetTest);
|
|
2050
3208
|
|
|
2051
3209
|
|
|
2052
3210
|
|
|
@@ -2058,8 +3216,8 @@ selector: "testCopying",
|
|
|
2058
3216
|
category: 'tests',
|
|
2059
3217
|
fn: function (){
|
|
2060
3218
|
var self=this;
|
|
2061
|
-
smalltalk.send(self,
|
|
2062
|
-
return self
|
|
3219
|
+
smalltalk.send(self,"_assert_equals_",[smalltalk.send(nil,"_copy",[]),nil]);
|
|
3220
|
+
return self},
|
|
2063
3221
|
args: [],
|
|
2064
3222
|
source: "testCopying\x0a\x09self assert: nil copy equals: nil",
|
|
2065
3223
|
messageSends: ["assert:equals:", "copy"],
|
|
@@ -2074,8 +3232,8 @@ selector: "testDeepCopy",
|
|
|
2074
3232
|
category: 'tests',
|
|
2075
3233
|
fn: function (){
|
|
2076
3234
|
var self=this;
|
|
2077
|
-
smalltalk.send(self,
|
|
2078
|
-
return self
|
|
3235
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(nil,"_deepCopy",[]),"__eq",[nil])]);
|
|
3236
|
+
return self},
|
|
2079
3237
|
args: [],
|
|
2080
3238
|
source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
|
|
2081
3239
|
messageSends: ["assert:", "=", "deepCopy"],
|
|
@@ -2090,11 +3248,31 @@ selector: "testIfNil",
|
|
|
2090
3248
|
category: 'tests',
|
|
2091
3249
|
fn: function (){
|
|
2092
3250
|
var self=this;
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
3251
|
+
var $1,$2,$3;
|
|
3252
|
+
if(($receiver = nil) == nil || $receiver == undefined){
|
|
3253
|
+
$1=true;
|
|
3254
|
+
} else {
|
|
3255
|
+
$1=nil;
|
|
3256
|
+
};
|
|
3257
|
+
smalltalk.send(self,"_assert_equals_",[$1,true]);
|
|
3258
|
+
if(($receiver = nil) == nil || $receiver == undefined){
|
|
3259
|
+
$2=nil;
|
|
3260
|
+
} else {
|
|
3261
|
+
$2=true;
|
|
3262
|
+
};
|
|
3263
|
+
smalltalk.send(self,"_deny_",[smalltalk.send($2,"__eq",[true])]);
|
|
3264
|
+
if(($receiver = nil) == nil || $receiver == undefined){
|
|
3265
|
+
$3=true;
|
|
3266
|
+
} else {
|
|
3267
|
+
$3=false;
|
|
3268
|
+
};
|
|
3269
|
+
smalltalk.send(self,"_assert_equals_",[$3,true]);
|
|
3270
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(nil,"_ifNotNil_ifNil_",[(function(){
|
|
3271
|
+
return true;
|
|
3272
|
+
}),(function(){
|
|
3273
|
+
return false;
|
|
3274
|
+
})]),"__eq",[true])]);
|
|
3275
|
+
return self},
|
|
2098
3276
|
args: [],
|
|
2099
3277
|
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
3278
|
messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
|
|
@@ -2109,9 +3287,9 @@ selector: "testIsNil",
|
|
|
2109
3287
|
category: 'tests',
|
|
2110
3288
|
fn: function (){
|
|
2111
3289
|
var self=this;
|
|
2112
|
-
smalltalk.send(self,
|
|
2113
|
-
smalltalk.send(self,
|
|
2114
|
-
return self
|
|
3290
|
+
smalltalk.send(self,"_assert_",[smalltalk.send(nil,"_isNil",[])]);
|
|
3291
|
+
smalltalk.send(self,"_deny_",[smalltalk.send(nil,"_notNil",[])]);
|
|
3292
|
+
return self},
|
|
2115
3293
|
args: [],
|
|
2116
3294
|
source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
|
|
2117
3295
|
messageSends: ["assert:", "isNil", "deny:", "notNil"],
|