resin 0.3.1 → 0.4.0

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.
Files changed (84) hide show
  1. data/amber/bin/amberc +10 -350
  2. data/amber/js/Benchfib.deploy.js +80 -89
  3. data/amber/js/Benchfib.js +80 -89
  4. data/amber/js/Canvas.deploy.js +558 -545
  5. data/amber/js/Canvas.js +563 -545
  6. data/amber/js/Compiler-AST.deploy.js +431 -243
  7. data/amber/js/Compiler-AST.js +487 -244
  8. data/amber/js/Compiler-Core.deploy.js +201 -1045
  9. data/amber/js/Compiler-Core.js +208 -1207
  10. data/amber/js/Compiler-Exceptions.deploy.js +37 -18
  11. data/amber/js/Compiler-Exceptions.js +42 -18
  12. data/amber/js/Compiler-IR.deploy.js +1071 -774
  13. data/amber/js/Compiler-IR.js +1194 -848
  14. data/amber/js/Compiler-Inlining.deploy.js +395 -373
  15. data/amber/js/Compiler-Inlining.js +395 -373
  16. data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
  17. data/amber/js/Compiler-Interpreter.js +1631 -0
  18. data/amber/js/Compiler-Semantic.deploy.js +695 -600
  19. data/amber/js/Compiler-Semantic.js +721 -611
  20. data/amber/js/Compiler-Tests.deploy.js +699 -376
  21. data/amber/js/Compiler-Tests.js +834 -381
  22. data/amber/js/Compiler.deploy.js +8563 -1805
  23. data/amber/js/Compiler.js +11476 -2633
  24. data/amber/js/Examples.deploy.js +29 -29
  25. data/amber/js/Examples.js +29 -29
  26. data/amber/js/IDE.deploy.js +3292 -2649
  27. data/amber/js/IDE.js +3318 -2710
  28. data/amber/js/Importer-Exporter.deploy.js +393 -349
  29. data/amber/js/Importer-Exporter.js +398 -354
  30. data/amber/js/Kernel-Announcements.deploy.js +53 -44
  31. data/amber/js/Kernel-Announcements.js +55 -44
  32. data/amber/js/Kernel-Classes.deploy.js +566 -368
  33. data/amber/js/Kernel-Classes.js +660 -402
  34. data/amber/js/Kernel-Collections.deploy.js +1149 -1098
  35. data/amber/js/Kernel-Collections.js +1183 -1116
  36. data/amber/js/Kernel-Exceptions.deploy.js +173 -75
  37. data/amber/js/Kernel-Exceptions.js +215 -77
  38. data/amber/js/Kernel-Methods.deploy.js +530 -313
  39. data/amber/js/Kernel-Methods.js +632 -338
  40. data/amber/js/Kernel-Objects.deploy.js +1734 -1577
  41. data/amber/js/Kernel-Objects.js +1867 -1654
  42. data/amber/js/Kernel-Tests.deploy.js +1416 -973
  43. data/amber/js/Kernel-Tests.js +1495 -981
  44. data/amber/js/Kernel-Transcript.deploy.js +23 -24
  45. data/amber/js/Kernel-Transcript.js +25 -26
  46. data/amber/js/SUnit-Tests.deploy.js +402 -0
  47. data/amber/js/SUnit-Tests.js +518 -0
  48. data/amber/js/SUnit.deploy.js +535 -237
  49. data/amber/js/SUnit.js +634 -246
  50. data/amber/js/amber.js +90 -53
  51. data/amber/js/boot.js +441 -255
  52. data/amber/js/init.js +1 -3
  53. data/amber/js/lib/CodeMirror/codemirror.css +3 -0
  54. data/amber/js/lib/CodeMirror/codemirror.js +104 -55
  55. data/amber/js/lib/peg-0.7.0.min.js +9 -0
  56. data/amber/js/parser.js +1504 -802
  57. data/amber/js/parser.pegjs +170 -165
  58. data/amber/st/Canvas.st +6 -0
  59. data/amber/st/Compiler-AST.st +54 -3
  60. data/amber/st/Compiler-Core.st +6 -551
  61. data/amber/st/Compiler-Exceptions.st +4 -0
  62. data/amber/st/Compiler-IR.st +205 -87
  63. data/amber/st/Compiler-Interpreter.st +597 -0
  64. data/amber/st/Compiler-Semantic.st +46 -21
  65. data/amber/st/Compiler-Tests.st +254 -7
  66. data/amber/st/Compiler.st +3172 -1541
  67. data/amber/st/IDE.st +57 -93
  68. data/amber/st/Importer-Exporter.st +4 -7
  69. data/amber/st/Kernel-Announcements.st +8 -0
  70. data/amber/st/Kernel-Classes.st +149 -40
  71. data/amber/st/Kernel-Collections.st +43 -32
  72. data/amber/st/Kernel-Exceptions.st +70 -1
  73. data/amber/st/Kernel-Methods.st +165 -27
  74. data/amber/st/Kernel-Objects.st +215 -140
  75. data/amber/st/Kernel-Tests.st +195 -10
  76. data/amber/st/Kernel-Transcript.st +1 -3
  77. data/amber/st/SUnit-Tests.st +186 -0
  78. data/amber/st/SUnit.st +186 -14
  79. data/bin/resin +6 -0
  80. data/lib/resin/cli.rb +19 -0
  81. metadata +41 -25
  82. data/amber/js/lib/peg-0.6.2.min.js +0 -2
  83. data/bin/resin-compile +0 -6
  84. data/bin/runresin +0 -12
@@ -0,0 +1,518 @@
1
+ smalltalk.addPackage('SUnit-Tests', {});
2
+ smalltalk.addClass('ExampleSetTest', smalltalk.TestCase, ['empty', 'full'], 'SUnit-Tests');
3
+ smalltalk.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework."
4
+ smalltalk.addMethod(
5
+ "_setUp",
6
+ smalltalk.method({
7
+ selector: "setUp",
8
+ category: 'running',
9
+ fn: function (){
10
+ var self=this;
11
+ return smalltalk.withContext(function($ctx1) {
12
+ self["@full"]=_st((smalltalk.Set || Set))._with_with_((5),smalltalk.symbolFor("abc"));
13
+ return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.ExampleSetTest)})},
14
+ args: [],
15
+ source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
16
+ messageSends: ["new", "with:with:"],
17
+ referencedClasses: ["Set"]
18
+ }),
19
+ smalltalk.ExampleSetTest);
20
+
21
+ smalltalk.addMethod(
22
+ "_testAdd",
23
+ smalltalk.method({
24
+ selector: "testAdd",
25
+ category: 'tests',
26
+ fn: function (){
27
+ var self=this;
28
+ return smalltalk.withContext(function($ctx1) {
29
+ _st(self)._assert_(_st(self["@empty"])._includes_((5)));
30
+ return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{}, smalltalk.ExampleSetTest)})},
31
+ args: [],
32
+ source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
33
+ messageSends: ["add:", "assert:", "includes:"],
34
+ referencedClasses: []
35
+ }),
36
+ smalltalk.ExampleSetTest);
37
+
38
+ smalltalk.addMethod(
39
+ "_testGrow",
40
+ smalltalk.method({
41
+ selector: "testGrow",
42
+ category: 'tests',
43
+ fn: function (){
44
+ var self=this;
45
+ return smalltalk.withContext(function($ctx1) {
46
+ _st(self)._assert_(_st(_st(self["@empty"])._size()).__eq((100)));
47
+ return self}, function($ctx1) {$ctx1.fill(self,"testGrow",{}, smalltalk.ExampleSetTest)})},
48
+ args: [],
49
+ source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size = 100",
50
+ messageSends: ["addAll:", "to:", "assert:", "=", "size"],
51
+ referencedClasses: []
52
+ }),
53
+ smalltalk.ExampleSetTest);
54
+
55
+ smalltalk.addMethod(
56
+ "_testIllegal",
57
+ smalltalk.method({
58
+ selector: "testIllegal",
59
+ category: 'tests',
60
+ fn: function (){
61
+ var self=this;
62
+ return smalltalk.withContext(function($ctx1) {
63
+ return smalltalk.withContext(function($ctx2) {
64
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
65
+ _st(self)._should_raise_((function(){
66
+ return smalltalk.withContext(function($ctx2) {
67
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
68
+ return self}, function($ctx1) {$ctx1.fill(self,"testIllegal",{}, smalltalk.ExampleSetTest)})},
69
+ args: [],
70
+ source: "testIllegal\x0a\x09self \x0a\x09\x09should: [empty at: 5] \x0a\x09\x09raise: Error.\x0a\x09self \x0a\x09\x09should: [empty at: 5 put: #abc] \x0a\x09\x09raise: Error",
71
+ messageSends: ["should:raise:", "at:", "at:put:"],
72
+ referencedClasses: ["Error"]
73
+ }),
74
+ smalltalk.ExampleSetTest);
75
+
76
+ smalltalk.addMethod(
77
+ "_testIncludes",
78
+ smalltalk.method({
79
+ selector: "testIncludes",
80
+ category: 'tests',
81
+ fn: function (){
82
+ var self=this;
83
+ return smalltalk.withContext(function($ctx1) {
84
+ _st(self)._assert_(_st(self["@full"])._includes_(smalltalk.symbolFor("abc")));
85
+ return self}, function($ctx1) {$ctx1.fill(self,"testIncludes",{}, smalltalk.ExampleSetTest)})},
86
+ args: [],
87
+ source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
88
+ messageSends: ["assert:", "includes:"],
89
+ referencedClasses: []
90
+ }),
91
+ smalltalk.ExampleSetTest);
92
+
93
+ smalltalk.addMethod(
94
+ "_testOccurrences",
95
+ smalltalk.method({
96
+ selector: "testOccurrences",
97
+ category: 'tests',
98
+ fn: function (){
99
+ var self=this;
100
+ return smalltalk.withContext(function($ctx1) {
101
+ _st(self)._assert_(_st(_st(self["@full"])._occurrencesOf_((5))).__eq((1)));
102
+ _st(self["@full"])._add_((5));
103
+ _st(self)._assert_(_st(_st(self["@full"])._occurrencesOf_((5))).__eq((1)));
104
+ return self}, function($ctx1) {$ctx1.fill(self,"testOccurrences",{}, smalltalk.ExampleSetTest)})},
105
+ args: [],
106
+ source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) = 0.\x0a\x09self assert: (full occurrencesOf: 5) = 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) = 1",
107
+ messageSends: ["assert:", "=", "occurrencesOf:", "add:"],
108
+ referencedClasses: []
109
+ }),
110
+ smalltalk.ExampleSetTest);
111
+
112
+ smalltalk.addMethod(
113
+ "_testRemove",
114
+ smalltalk.method({
115
+ selector: "testRemove",
116
+ category: 'tests',
117
+ fn: function (){
118
+ var self=this;
119
+ return smalltalk.withContext(function($ctx1) {
120
+ _st(self)._assert_(_st(self["@full"])._includes_(smalltalk.symbolFor("abc")));
121
+ _st(self)._deny_(_st(self["@full"])._includes_((5)));
122
+ return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{}, smalltalk.ExampleSetTest)})},
123
+ args: [],
124
+ source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
125
+ messageSends: ["remove:", "assert:", "includes:", "deny:"],
126
+ referencedClasses: []
127
+ }),
128
+ smalltalk.ExampleSetTest);
129
+
130
+
131
+
132
+ smalltalk.addClass('SUnitAsyncTest', smalltalk.TestCase, ['flag'], 'SUnit-Tests');
133
+ smalltalk.addMethod(
134
+ "_fakeError",
135
+ smalltalk.method({
136
+ selector: "fakeError",
137
+ category: 'helpers',
138
+ fn: function (){
139
+ var self=this;
140
+ return smalltalk.withContext(function($ctx1) {
141
+ _st(self)._timeout_((10));
142
+ self["@flag"]=_st(_st(self)._async_((function(){
143
+ return smalltalk.withContext(function($ctx2) {
144
+ self["@flag"];
145
+ return _st(self)._error_("Intentional");
146
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
147
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeError",{}, smalltalk.SUnitAsyncTest)})},
148
+ args: [],
149
+ source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 5",
150
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"],
151
+ referencedClasses: []
152
+ }),
153
+ smalltalk.SUnitAsyncTest);
154
+
155
+ smalltalk.addMethod(
156
+ "_fakeErrorFailingInTearDown",
157
+ smalltalk.method({
158
+ selector: "fakeErrorFailingInTearDown",
159
+ category: 'helpers',
160
+ fn: function (){
161
+ var self=this;
162
+ return smalltalk.withContext(function($ctx1) {
163
+ _st(self)._timeout_((10));
164
+ self["@flag"]=_st(_st(self)._async_((function(){
165
+ return smalltalk.withContext(function($ctx2) {
166
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
167
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{}, smalltalk.SUnitAsyncTest)})},
168
+ args: [],
169
+ source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 5",
170
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"],
171
+ referencedClasses: []
172
+ }),
173
+ smalltalk.SUnitAsyncTest);
174
+
175
+ smalltalk.addMethod(
176
+ "_fakeFailure",
177
+ smalltalk.method({
178
+ selector: "fakeFailure",
179
+ category: 'helpers',
180
+ fn: function (){
181
+ var self=this;
182
+ return smalltalk.withContext(function($ctx1) {
183
+ _st(self)._timeout_((10));
184
+ self["@flag"]=_st(_st(self)._async_((function(){
185
+ return smalltalk.withContext(function($ctx2) {
186
+ self["@flag"];
187
+ return _st(self)._assert_(false);
188
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
189
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeFailure",{}, smalltalk.SUnitAsyncTest)})},
190
+ args: [],
191
+ source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 5",
192
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"],
193
+ referencedClasses: []
194
+ }),
195
+ smalltalk.SUnitAsyncTest);
196
+
197
+ smalltalk.addMethod(
198
+ "_fakeMultipleTimeoutFailing",
199
+ smalltalk.method({
200
+ selector: "fakeMultipleTimeoutFailing",
201
+ category: 'helpers',
202
+ fn: function (){
203
+ var self=this;
204
+ return smalltalk.withContext(function($ctx1) {
205
+ _st(_st(self)._async_((function(){
206
+ return smalltalk.withContext(function($ctx2) {
207
+ return _st(_st(self)._async_((function(){
208
+ return smalltalk.withContext(function($ctx3) {
209
+ }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._valueWithTimeout_((10));
210
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
211
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{}, smalltalk.SUnitAsyncTest)})},
212
+ args: [],
213
+ source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a (self async: [\x0a\x09\x09self timeout: 5.\x0a (self async: [ self finished ]) valueWithTimeout: 10\x0a\x09]) valueWithTimeout: 5",
214
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
215
+ referencedClasses: []
216
+ }),
217
+ smalltalk.SUnitAsyncTest);
218
+
219
+ smalltalk.addMethod(
220
+ "_fakeMultipleTimeoutPassing",
221
+ smalltalk.method({
222
+ selector: "fakeMultipleTimeoutPassing",
223
+ category: 'helpers',
224
+ fn: function (){
225
+ var self=this;
226
+ return smalltalk.withContext(function($ctx1) {
227
+ _st(_st(self)._async_((function(){
228
+ return smalltalk.withContext(function($ctx2) {
229
+ return _st(_st(self)._async_((function(){
230
+ return smalltalk.withContext(function($ctx3) {
231
+ }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._valueWithTimeout_((10));
232
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
233
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{}, smalltalk.SUnitAsyncTest)})},
234
+ args: [],
235
+ source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 10.\x0a (self async: [\x0a\x09\x09self timeout: 20.\x0a (self async: [ self finished ]) valueWithTimeout: 10\x0a\x09]) valueWithTimeout: 5",
236
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
237
+ referencedClasses: []
238
+ }),
239
+ smalltalk.SUnitAsyncTest);
240
+
241
+ smalltalk.addMethod(
242
+ "_fakeTimeout",
243
+ smalltalk.method({
244
+ selector: "fakeTimeout",
245
+ category: 'helpers',
246
+ fn: function (){
247
+ var self=this;
248
+ return smalltalk.withContext(function($ctx1) {
249
+ _st(_st(self)._async_((function(){
250
+ return smalltalk.withContext(function($ctx2) {
251
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
252
+ return self}, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{}, smalltalk.SUnitAsyncTest)})},
253
+ args: [],
254
+ source: "fakeTimeout\x0a\x09self timeout: 4.\x0a (self async: [ self finished ]) valueWithTimeout: 5",
255
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
256
+ referencedClasses: []
257
+ }),
258
+ smalltalk.SUnitAsyncTest);
259
+
260
+ smalltalk.addMethod(
261
+ "_setUp",
262
+ smalltalk.method({
263
+ selector: "setUp",
264
+ category: 'running',
265
+ fn: function (){
266
+ var self=this;
267
+ return smalltalk.withContext(function($ctx1) {
268
+ return self}, function($ctx1) {$ctx1.fill(self,"setUp",{}, smalltalk.SUnitAsyncTest)})},
269
+ args: [],
270
+ source: "setUp\x0a\x09flag := 'ok'",
271
+ messageSends: [],
272
+ referencedClasses: []
273
+ }),
274
+ smalltalk.SUnitAsyncTest);
275
+
276
+ smalltalk.addMethod(
277
+ "_sortedSelectors_",
278
+ smalltalk.method({
279
+ selector: "sortedSelectors:",
280
+ category: 'private',
281
+ fn: function (aCollection){
282
+ var self=this;
283
+ return smalltalk.withContext(function($ctx1) {
284
+ $1=_st(_st(aCollection)._collect_((function(each){
285
+ return smalltalk.withContext(function($ctx2) {
286
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._sorted();
287
+ return $1;
288
+ }, function($ctx1) {$ctx1.fill(self,"sortedSelectors:",{aCollection:aCollection}, smalltalk.SUnitAsyncTest)})},
289
+ args: ["aCollection"],
290
+ source: "sortedSelectors: aCollection\x0a\x09^(aCollection collect: [:each | each selector]) sorted",
291
+ messageSends: ["sorted", "collect:", "selector"],
292
+ referencedClasses: []
293
+ }),
294
+ smalltalk.SUnitAsyncTest);
295
+
296
+ smalltalk.addMethod(
297
+ "_tearDown",
298
+ smalltalk.method({
299
+ selector: "tearDown",
300
+ category: 'running',
301
+ fn: function (){
302
+ var self=this;
303
+ return smalltalk.withContext(function($ctx1) {
304
+ return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{}, smalltalk.SUnitAsyncTest)})},
305
+ args: [],
306
+ source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
307
+ messageSends: ["assert:equals:"],
308
+ referencedClasses: []
309
+ }),
310
+ smalltalk.SUnitAsyncTest);
311
+
312
+ smalltalk.addMethod(
313
+ "_testAsyncErrorsAndFailures",
314
+ smalltalk.method({
315
+ selector: "testAsyncErrorsAndFailures",
316
+ category: 'tests',
317
+ fn: function (){
318
+ var self=this;
319
+ var suite,runner,result,assertBlock;
320
+ return smalltalk.withContext(function($ctx1) {
321
+ suite=_st(["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"])._collect_((function(each){
322
+ return smalltalk.withContext(function($ctx2) {
323
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
324
+ runner=_st((smalltalk.TestSuiteRunner || TestSuiteRunner))._on_(suite);
325
+ _st(self)._timeout_((200));
326
+ result=_st(runner)._result();
327
+ assertBlock=_st(self)._async_((function(){
328
+ return smalltalk.withContext(function($ctx2) {
329
+ _st(self)._assert_equals_(["fakeErrorFailingInTearDown", "fakeFailure"],_st(self)._sortedSelectors_(_st(result)._failures()));
330
+ return _st(self)._finished();
331
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
332
+ $1=_st(runner)._announcer();
333
+ $2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
334
+ $3=(function(ann){
335
+ return smalltalk.withContext(function($ctx2) {
336
+ $5=(function(){
337
+ return smalltalk.withContext(function($ctx3) {
338
+ return _st($6)._ifTrue_(assertBlock);
339
+ }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
340
+ return _st($4)._ifTrue_($5);
341
+ }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})});
342
+ _st($1)._on_do_($2,$3);
343
+ _st(runner)._run();
344
+ return self}, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock}, smalltalk.SUnitAsyncTest)})},
345
+ args: [],
346
+ source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a runner := TestSuiteRunner on: suite.\x0a self timeout: 200.\x0a\x09result := runner result.\x0a assertBlock := self async: [\x0a\x09\x09self assert: #('fakeError') equals: (self sortedSelectors: result errors).\x0a\x09\x09self assert: #('fakeErrorFailingInTearDown' 'fakeFailure') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a \x09].\x0a runner announcer on: ResultAnnouncement do: [:ann |\x0a \x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
347
+ messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "sortedSelectors:", "errors", "failures", "finished", "on:do:", "ifTrue:", "=", "total", "runs", "==", "announcer", "run"],
348
+ referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"]
349
+ }),
350
+ smalltalk.SUnitAsyncTest);
351
+
352
+ smalltalk.addMethod(
353
+ "_testAsyncNeedsTimeout",
354
+ smalltalk.method({
355
+ selector: "testAsyncNeedsTimeout",
356
+ category: 'tests',
357
+ fn: function (){
358
+ var self=this;
359
+ return smalltalk.withContext(function($ctx1) {
360
+ return smalltalk.withContext(function($ctx2) {
361
+ return smalltalk.withContext(function($ctx3) {
362
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
363
+ _st(self)._timeout_((0));
364
+ _st(self)._shouldnt_raise_((function(){
365
+ return smalltalk.withContext(function($ctx2) {
366
+ return smalltalk.withContext(function($ctx3) {
367
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
368
+ _st(self)._finished();
369
+ return self}, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{}, smalltalk.SUnitAsyncTest)})},
370
+ args: [],
371
+ source: "testAsyncNeedsTimeout\x0a self should: [ self async: [ ] ] raise: Error.\x0a self timeout: 0.\x0a self shouldnt: [ self async: [ ] ] raise: Error.\x0a self finished",
372
+ messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"],
373
+ referencedClasses: ["Error"]
374
+ }),
375
+ smalltalk.SUnitAsyncTest);
376
+
377
+ smalltalk.addMethod(
378
+ "_testFinishedNeedsTimeout",
379
+ smalltalk.method({
380
+ selector: "testFinishedNeedsTimeout",
381
+ category: 'tests',
382
+ fn: function (){
383
+ var self=this;
384
+ return smalltalk.withContext(function($ctx1) {
385
+ return smalltalk.withContext(function($ctx2) {
386
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
387
+ _st(self)._timeout_((0));
388
+ _st(self)._shouldnt_raise_((function(){
389
+ return smalltalk.withContext(function($ctx2) {
390
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(smalltalk.Error || Error));
391
+ return self}, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{}, smalltalk.SUnitAsyncTest)})},
392
+ args: [],
393
+ source: "testFinishedNeedsTimeout\x0a self should: [ self finished ] raise: Error.\x0a self timeout: 0.\x0a self shouldnt: [ self finished ] raise: Error.",
394
+ messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"],
395
+ referencedClasses: ["Error"]
396
+ }),
397
+ smalltalk.SUnitAsyncTest);
398
+
399
+ smalltalk.addMethod(
400
+ "_testIsAsyncReturnsCorrectValues",
401
+ smalltalk.method({
402
+ selector: "testIsAsyncReturnsCorrectValues",
403
+ category: 'tests',
404
+ fn: function (){
405
+ var self=this;
406
+ return smalltalk.withContext(function($ctx1) {
407
+ _st(self)._timeout_((0));
408
+ _st(self)._assert_(_st(self)._isAsync());
409
+ _st(self)._finished();
410
+ _st(self)._deny_(_st(self)._isAsync());
411
+ return self}, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{}, smalltalk.SUnitAsyncTest)})},
412
+ args: [],
413
+ source: "testIsAsyncReturnsCorrectValues\x0a self deny: self isAsync.\x0a self timeout: 0.\x0a self assert: self isAsync.\x0a self finished.\x0a self deny: self isAsync",
414
+ messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"],
415
+ referencedClasses: []
416
+ }),
417
+ smalltalk.SUnitAsyncTest);
418
+
419
+ smalltalk.addMethod(
420
+ "_testPass",
421
+ smalltalk.method({
422
+ selector: "testPass",
423
+ category: 'tests',
424
+ fn: function (){
425
+ var self=this;
426
+ return smalltalk.withContext(function($ctx1) {
427
+ _st(self)._timeout_((10));
428
+ self["@flag"]=_st(_st(self)._async_((function(){
429
+ return smalltalk.withContext(function($ctx2) {
430
+ _st(self)._finished();
431
+ self["@flag"]="ok";
432
+ return self["@flag"];
433
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((5));
434
+ return self}, function($ctx1) {$ctx1.fill(self,"testPass",{}, smalltalk.SUnitAsyncTest)})},
435
+ args: [],
436
+ source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
437
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"],
438
+ referencedClasses: []
439
+ }),
440
+ smalltalk.SUnitAsyncTest);
441
+
442
+ smalltalk.addMethod(
443
+ "_testTimeouts",
444
+ smalltalk.method({
445
+ selector: "testTimeouts",
446
+ category: 'tests',
447
+ fn: function (){
448
+ var self=this;
449
+ var suite,runner,result,assertBlock;
450
+ return smalltalk.withContext(function($ctx1) {
451
+ suite=_st(["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"])._collect_((function(each){
452
+ return smalltalk.withContext(function($ctx2) {
453
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
454
+ runner=_st((smalltalk.TestSuiteRunner || TestSuiteRunner))._on_(suite);
455
+ _st(self)._timeout_((200));
456
+ result=_st(runner)._result();
457
+ assertBlock=_st(self)._async_((function(){
458
+ return smalltalk.withContext(function($ctx2) {
459
+ _st(self)._assert_equals_(["fakeMultipleTimeoutFailing", "fakeTimeout"],_st(self)._sortedSelectors_(_st(result)._failures()));
460
+ return _st(self)._finished();
461
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
462
+ $1=_st(runner)._announcer();
463
+ $2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
464
+ $3=(function(ann){
465
+ return smalltalk.withContext(function($ctx2) {
466
+ $5=(function(){
467
+ return smalltalk.withContext(function($ctx3) {
468
+ return _st($6)._ifTrue_(assertBlock);
469
+ }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
470
+ return _st($4)._ifTrue_($5);
471
+ }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})});
472
+ _st($1)._on_do_($2,$3);
473
+ _st(runner)._run();
474
+ return self}, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock}, smalltalk.SUnitAsyncTest)})},
475
+ args: [],
476
+ source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a runner := TestSuiteRunner on: suite.\x0a self timeout: 200.\x0a\x09result := runner result.\x0a assertBlock := self async: [\x0a\x09\x09self assert: result errors isEmpty.\x0a\x09\x09self assert: #('fakeMultipleTimeoutFailing' 'fakeTimeout') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a \x09].\x0a runner announcer on: ResultAnnouncement do: [:ann |\x0a \x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
477
+ messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:", "isEmpty", "errors", "assert:equals:", "sortedSelectors:", "failures", "finished", "on:do:", "ifTrue:", "=", "total", "runs", "==", "announcer", "run"],
478
+ referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"]
479
+ }),
480
+ smalltalk.SUnitAsyncTest);
481
+
482
+ smalltalk.addMethod(
483
+ "_testTwoAsyncPassesWithFinishedOnlyOneIsRun",
484
+ smalltalk.method({
485
+ selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
486
+ category: 'tests',
487
+ fn: function (){
488
+ var self=this;
489
+ var x;
490
+ return smalltalk.withContext(function($ctx1) {
491
+ _st(self)._timeout_((10));
492
+ x=(0);
493
+ self["@flag"]=_st(_st(self)._async_((function(){
494
+ return smalltalk.withContext(function($ctx2) {
495
+ self["@flag"]="ok";
496
+ self["@flag"];
497
+ x=_st(x).__plus((1));
498
+ x;
499
+ return _st(self)._assert_equals_((1),x);
500
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
501
+ self["@flag"]=_st(_st(self)._async_((function(){
502
+ return smalltalk.withContext(function($ctx2) {
503
+ self["@flag"]="ok";
504
+ self["@flag"];
505
+ x=_st(x).__plus((1));
506
+ x;
507
+ return _st(self)._assert_equals_((1),x);
508
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._valueWithTimeout_((0));
509
+ return self}, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x}, smalltalk.SUnitAsyncTest)})},
510
+ args: [],
511
+ source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a x := 0.\x0a flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: 1 equals: x ]) valueWithTimeout: 0.\x0a flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: 1 equals: x ]) valueWithTimeout: 0.",
512
+ messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"],
513
+ referencedClasses: []
514
+ }),
515
+ smalltalk.SUnitAsyncTest);
516
+
517
+
518
+