asproject 0.1.92 → 0.1.118

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 (111) hide show
  1. data/lib/asclass_arguments.rb +1 -1
  2. data/lib/asproject.rb +3 -1
  3. data/lib/asproject/version.rb +1 -1
  4. data/lib/asproject_arguments.rb +5 -5
  5. data/lib/path_finder.rb +17 -7
  6. data/lib/tasks/asunit.rb +8 -0
  7. data/lib/tasks/flash_log.rb +2 -1
  8. data/lib/tasks/flash_player.rb +10 -6
  9. data/lib/tasks/mxmlc.rb +13 -2
  10. data/lib/tasks/remote_file_loader.rb +144 -0
  11. data/lib/tasks/remote_file_task.rb +2 -128
  12. data/lib/tasks/remote_library_task.rb +75 -0
  13. data/templates/asclass/as2/Class.as +1 -1
  14. data/templates/asproject/as2/{art → assets}/.crap_file +0 -0
  15. data/templates/asproject/as2/project/rakefile.rb +3 -2
  16. data/templates/asproject/as3/{art → assets}/.crap_file +0 -0
  17. data/templates/asproject/as3/project/rakefile.rb +3 -3
  18. data/templates/asproject/fdt/project/.as2_classpath +1 -1
  19. metadata +9 -129
  20. data/templates/asproject/asunit2/project/lib/asunit/AsUnitUi.swf +0 -0
  21. data/templates/asproject/asunit2/project/lib/asunit/Sys.as +0 -70
  22. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanel.as +0 -182
  23. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTest.as +0 -84
  24. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextArea.as +0 -111
  25. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextAreaTest.as +0 -26
  26. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTitleBar.as +0 -81
  27. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ResizeHandle.as +0 -35
  28. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollArrow.as +0 -34
  29. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollHandle.as +0 -43
  30. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollListener.as +0 -10
  31. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/TextScroller.as +0 -169
  32. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Rectangle.as +0 -29
  33. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Triangle.as +0 -27
  34. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/AsUnit.as +0 -19
  35. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assert.as +0 -408
  36. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assertion.as +0 -27
  37. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Reflection.as +0 -68
  38. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Test.as +0 -3
  39. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCase.as +0 -191
  40. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCaseXml.as +0 -31
  41. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestFailure.as +0 -15
  42. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestResult.as +0 -15
  43. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestRunner.as +0 -41
  44. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSetup.as +0 -19
  45. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSuite.as +0 -22
  46. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/Main.as +0 -325
  47. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/RemoteVersion.as +0 -24
  48. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/SuccessMeter.as +0 -32
  49. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Comparable.as +0 -7
  50. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventListener.as +0 -29
  51. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventSource.as +0 -89
  52. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnClient.as +0 -42
  53. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnGateway.as +0 -47
  54. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnServer.as +0 -61
  55. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalMessageBroker.as +0 -58
  56. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Observable.as +0 -11
  57. data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/TextFile.as +0 -30
  58. data/templates/asproject/asunit25/project/lib/asunit/AsUnitTestRunner.as +0 -13
  59. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionFailedError.as +0 -7
  60. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionPassedError.as +0 -7
  61. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/ClassNotFoundError.as +0 -7
  62. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/IllegalOperationError.as +0 -7
  63. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +0 -7
  64. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InvocationTargetError.as +0 -7
  65. data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +0 -7
  66. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Assert.as +0 -376
  67. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertMock.as +0 -15
  68. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertTest.as +0 -59
  69. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/ITestListener.as +0 -13
  70. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Test.as +0 -11
  71. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCase.as +0 -278
  72. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseMock.as +0 -23
  73. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseTest.as +0 -29
  74. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseXml.as +0 -38
  75. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestFailure.as +0 -47
  76. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestResult.as +0 -168
  77. data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestSuite.as +0 -102
  78. data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/BaseTestRunner.as +0 -101
  79. data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/IResultPrinter.as +0 -8
  80. data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/ResultPrinter.as +0 -254
  81. data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/SuccessBar.as +0 -41
  82. data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/TestRunner.as +0 -17
  83. data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIterator.as +0 -24
  84. data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIteratorTest.as +0 -52
  85. data/templates/asproject/asunit25/project/lib/asunit/asunit/util/Iterator.as +0 -5
  86. data/templates/asproject/asunit3/project/lib/asunit/AsUnitTestRunner.as +0 -10
  87. data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AbstractMemberCalledError.as +0 -10
  88. data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AssertionFailedError.as +0 -10
  89. data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/ClassNotFoundError.as +0 -10
  90. data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +0 -10
  91. data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +0 -10
  92. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Assert.as +0 -271
  93. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as +0 -52
  94. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCaseExample.as +0 -71
  95. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Test.as +0 -15
  96. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCase.as +0 -354
  97. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCaseExample.as +0 -73
  98. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestFailure.as +0 -47
  99. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestListener.as +0 -22
  100. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestResult.as +0 -158
  101. data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestSuite.as +0 -115
  102. data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/BaseTestRunner.as +0 -15
  103. data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/TestSuiteLoader.as +0 -9
  104. data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/Version.as +0 -11
  105. data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexRunner.as +0 -19
  106. data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexTestRunner.as +0 -55
  107. data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/ResultPrinter.as +0 -245
  108. data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/TestRunner.as +0 -121
  109. data/templates/asproject/asunit3/project/lib/asunit/asunit/util/ArrayIterator.as +0 -26
  110. data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Iterator.as +0 -9
  111. data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Properties.as +0 -30
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.AssertionFailedError extends Error {
3
-
4
- public function AssertionFailedError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.AssertionPassedError extends Error {
3
-
4
- public function AssertionPassedError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.ClassNotFoundError extends Error {
3
-
4
- public function ClassNotFoundError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.IllegalOperationError extends Error {
3
-
4
- public function IllegalOperationError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.InstanceNotFoundError extends Error {
3
-
4
- public function InstanceNotFoundError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.InvocationTargetError extends Error {
3
-
4
- public function InvocationTargetError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,7 +0,0 @@
1
-
2
- class asunit.errors.UnimplementedFeatureError extends Error {
3
-
4
- public function UnimplementedFeatureError(msg:String) {
5
- super(msg);
6
- }
7
- }
@@ -1,376 +0,0 @@
1
- import asunit.errors.AssertionFailedError;
2
- import asunit.errors.IllegalOperationError;
3
-
4
- /**
5
- * Provides assert methods and other utility methods which are inherited by
6
- * the {@link TestCase} subclass. Since all user-defined test cases should
7
- * extend {@link TestCase} you should never have to use this class
8
- * directly.
9
- *
10
- * @see TestCase
11
- */
12
- class asunit.framework.Assert {
13
- private static var defaultClassName:String = "[ClassName Unknown]";
14
- private static var lastDepth:Number = 10;
15
-
16
- private function Assert() {
17
- }
18
-
19
- /**
20
- * Returns the next available depth for attaching a MovieClip.
21
- *
22
- * @return
23
- * Number of next available depth.
24
- */
25
- public static function nextDepth():Number {
26
- return Assert.lastDepth++;
27
- }
28
-
29
- /**
30
- * Appends a test result to the {@link TestRunner} which manages test
31
- * result output. This method is intended for use by the AsUnit
32
- * framework and should never have to be called directly.
33
- *
34
- * @param msg
35
- * The message associated with the assertion.
36
- * @param assertType
37
- * The assertion type.
38
- * @param passFail
39
- * Indicates whether the test passed (<code>true</code>) or
40
- * failed (<code>false</code>).
41
- *
42
- */
43
- public static function addTestResult(msg:String, assertType:String, passed:Boolean) {
44
- if(!passed) {
45
- var str:String = "";
46
- if(msg != "") {
47
- str += assertType + ".message: " + msg;
48
- }
49
- fail(str);
50
- }
51
- }
52
-
53
- /**
54
- * Returns a reference to the {@link TestRunner} instance which manages
55
- * the output of test results. This method is intended for use by the
56
- * AsUnit framework and should never have to be called directly.
57
- private static function getTestRunner():TestRunner {
58
- if(testRunner == null) {
59
- testRunner = new TestRunner();
60
- }
61
- return testRunner;
62
- }
63
- */
64
-
65
- /**
66
- * Returns the number of {@link TestCases} that have completed.
67
- public static function countTestCases():Number {
68
- return testRunner.length;
69
- }
70
- */
71
-
72
- /**
73
- * Asserts that two objects are equal. If either of the
74
- * objects provides an <code>equals()</code> method it will be used to
75
- * determine equality. Otherwise, equality will be evaluated using the
76
- * strict equality operator (<code>===</code>).<br />
77
- * <br />
78
- * The method below tests the <code>getFullName()</code> method of the
79
- * <code>Person</code> class to make sure that the formatting of its
80
- * return value is correct.<br />
81
- *
82
- * <pre>
83
- * public function testGetFullName():Void {
84
- * var person:Person = new Person("John", "Alan", "Smith");
85
- * assertEquals("full name should be formatted: [first] [middleInitial]. [last]",
86
- * "John A. Smith",
87
- * person.getFullName());
88
- * }
89
- * </pre>
90
- *
91
- * @param msg
92
- * Optional; Message to display should the test fail. It is
93
- * recommended that this message describe what is asserted to be
94
- * true rather than describing what went wrong.
95
- * @param assertion1
96
- * First object to use in evaluation.
97
- * @param assertion2
98
- * Second object to use in evaluation.
99
- */
100
- public static function assertEquals(msg:Object, assertion1:Object, assertion2:Object):Void {
101
- if(arguments.length == 2) {
102
- assertion2 = assertion1;
103
- assertion1 = msg;
104
- msg = "";
105
- }
106
- if(assertion1["equals"] instanceof Function) {
107
- addTestResult(String(msg), "assertEquals", assertion1["equals"](assertion2));
108
- } else if(assertion2["equals"] != undefined) {
109
- addTestResult(String(msg), "assertEquals", assertion2["equals"](assertion1));
110
- } else {
111
- addTestResult(format(String(msg), assertion1, assertion2), "assertEquals", assertion1 == assertion2);
112
- }
113
-
114
- }
115
-
116
- /**
117
- * Asserts that a value is <code>null</code>.<br />
118
- * <br />
119
- * The method below tests to confirm that the parameter passed to the
120
- * <code>getProductBySku</code> method of the
121
- * <code>ProductCatalog</code> is treated as case sensitive.<br />
122
- *
123
- * <pre>
124
- * public function testGetProductBySku():Void {
125
- * // Set up a fixture to test against.
126
- * var productCatalog:ProductCatalog = new ProductCatalog();
127
- * productCatalog.addProduct(new Product("sku123a"));
128
- *
129
- * // Try retrieving a product using improper text case.
130
- * var product:Product = productCatalog.getProductBySku("SKU123A");
131
- * assertNull("the SKU parameter should be case sensitive",
132
- * product);
133
- * }
134
- * </pre>
135
- *
136
- * @param msg
137
- * Optional; Message to display should the test fail. It is
138
- * recommended that this message describe what is asserted to be
139
- * true rather than describing what went wrong.
140
- * @param assertion
141
- * Object to be evaluated.
142
- */
143
- public static function assertNull(msg:Object, assertion:Object):Void {
144
- if(arguments.length == 1) {
145
- assertion = msg;
146
- msg = "";
147
- }
148
- addTestResult(String(msg), "assertNull", (assertion === null));
149
- }
150
-
151
- /**
152
- * Asserts that a value is not <code>null</code>.<br />
153
- * <br />
154
- * The method below tests to confirm that the parameter passed to the
155
- * <code>getColorByName</code> method of the <code>ColorManager</code>
156
- * class is treated as case insensitive.<br />
157
- *
158
- * <pre>
159
- * public function testGetColorByName():Void {
160
- * // Set up a fixture to test against.
161
- * var colorManager:ColorManager = new ColorManager();
162
- * colorManager.addColor(new Color("blue"));
163
- *
164
- * // Try retrieving a color using alternate text case.
165
- * var color:Color = colorManager.getColorByName("Blue");
166
- * assertNotNull("color name parameter should not be case sensitive",
167
- * color);
168
- * }
169
- * </pre>
170
- *
171
- * @param msg
172
- * Optional; Message to display should the test fail. It is
173
- * recommended that this message describe what is asserted to be
174
- * true rather than describing what went wrong.
175
- * @param assertion
176
- * Object to be evaluated.
177
- */
178
- public static function assertNotNull(msg:Object, assertion:Object):Void {
179
- if(arguments.length == 1) {
180
- assertion = msg;
181
- msg = "";
182
- }
183
- addTestResult(String(msg), "assertNotNull", (assertion !== null));
184
- }
185
-
186
- /**
187
- * Asserts that a value is <code>undefined</code>.
188
- *
189
- * @param msg
190
- * Optional; Message to display should the test fail. It is
191
- * recommended that this message describe what is asserted to be
192
- * true rather than describing what went wrong.
193
- * @param assertion
194
- * Object to be evaluated.
195
- */
196
- public static function assertUndefined(msg:Object, assertion:Object):Void {
197
- if(arguments.length == 1) {
198
- assertion = msg;
199
- msg = "";
200
- }
201
- addTestResult(String(msg), "assertUndefined", (assertion === undefined));
202
- }
203
-
204
- /**
205
- * Asserts that a value is not <code>undefined</code>.
206
- *
207
- * @param msg
208
- * Optional; Message to display should the test fail. It is
209
- * recommended that this message describe what is asserted to be
210
- * true rather than describing what went wrong.
211
- * @param assertion
212
- * Object to be evaluated.
213
- */
214
- public static function assertNotUndefined(msg:Object, assertion:Object):Void {
215
- if(arguments.length == 1) {
216
- assertion = msg;
217
- msg = "";
218
- }
219
- addTestResult(String(msg), "assertNotUndefined", (assertion !== undefined));
220
- }
221
-
222
- /**
223
- * Asserts that two variables are pointing to the same object in
224
- * memory.<br />
225
- * <br />
226
- * The method below tests to confirm that the static
227
- * <code>getInstance()</code> method of the <code>ServiceLocator</code>
228
- * class always returns a reference to the same instance of
229
- * <code>ServiceLocator</code>.<br />
230
- *
231
- * <pre>
232
- * public function testGetInstance():Void {
233
- * var instance1:ServiceLocator = ServiceLocator.getInstance();
234
- * var instance2:ServiceLocator = ServiceLocator.getInstance();
235
- * assertSame("getInstance() should always return the same ServiceLocator instance",
236
- * instance1,
237
- * instance2);
238
- * }
239
- * </code>
240
- *
241
- * @param msg
242
- * Optional; Message to display should the test fail. It is
243
- * recommended that this message describe what is asserted to be
244
- * true rather than describing what went wrong.
245
- * @param object1
246
- * First object to use in evaluation.
247
- * @param object2
248
- * Second object to use in evaluation.
249
- */
250
- public static function assertSame(msg:Object, object1:Object, object2:Object):Void {
251
- if(arguments.length == 2) {
252
- object2 = object1;
253
- object1 = msg;
254
- msg = "";
255
- }
256
- addTestResult(String(msg), "assertSame", (object1 === object2));
257
- }
258
-
259
- /**
260
- * Asserts that a statement evaluates to <code>true</code>. Since this
261
- * method lets you pass in any expression that evaluates to a boolean
262
- * value, it is a good method to fall back on when the other
263
- * <code>assert<i>XXX</i></code> methods don't provide the kind of
264
- * functionality your test requires.<br />
265
- * <br />
266
- * The method below test to confirm that new <code>Product</code> objects
267
- * are assigned ascending catalog numbers when created by the
268
- * <code>ProductGenerator</code> class.<br />
269
- *
270
- * <pre>
271
- * public function testMakeProductCatalogNumberAssignement():Void {
272
- * var generator:ProductGenerator = ProductGenerator.getInstance();
273
- * var product1:Product = generator.makeProduct("sku123");
274
- * var product2:Product = generator.makeProduct("sku456");
275
- * assertTrue("products should be assigned ascending catalog numbers",
276
- * product1.catNumber &lt; product2.catNumber);
277
- * }
278
- * </code>
279
- *
280
- * @param msg
281
- * Optional; Message to display should the test fail. It is
282
- * recommended that this message describe what is asserted to be
283
- * true rather than describing what went wrong.
284
- * @param assertion
285
- * A statement that evaluates to a boolean value.
286
- */
287
- public static function assertTrue(msg:Object, assertion:Boolean):Void {
288
- if(arguments.length == 1) {
289
- assertion = Boolean(msg);
290
- msg = "";
291
- }
292
-
293
- if(arguments.length > 2) {
294
- failError("Argument Count Exceeded " + String(msg), "assertTrue");
295
- }
296
- addTestResult(String(msg), "assertTrue", assertion);
297
- }
298
-
299
- /**
300
- * Asserts that a statement evaluates to <code>false</code>. Since this
301
- * method lets you pass in any expression that evaluates to a boolean
302
- * value, it is a good method to fall back on when the other
303
- * <code>assert<i>XXX</i></code> methods don't provide the kind of
304
- * functionality your test requires.<br />
305
- * <br />
306
- * The method below tests to confirm that the return value of the
307
- * <code>truncate()</code> method of the <code>TextUtil</code>
308
- * class is no longer than the specified limit<br />
309
- *
310
- * <pre>
311
- * public function testTruncate():Void {
312
- * var limit:Number = 30;
313
- * var text:String = "As a reviewer, I got an early opportunity to read the book you are holding.";
314
- * var clippedText:String = TextUtil.truncate(text, limit);
315
- * assertFalse("return value should be no more than 30 characters",
316
- * clippedText.length &gt; 30);
317
- * }
318
- * </code>
319
- *
320
- * @param msg
321
- * Optional; Message to display should the test fail. It is
322
- * recommended that this message describe what is asserted to be
323
- * true rather than describing what went wrong.
324
- * @param assertion
325
- * A statement that evaluates to a boolean value.
326
- */
327
- public static function assertFalse(msg:Object, assertion:Boolean):Void {
328
- if(arguments.length == 1) {
329
- assertion = Boolean(msg);
330
- msg = "";
331
- }
332
- addTestResult(String(msg), "assertFalse", !assertion);
333
- }
334
-
335
- /**
336
- * Forces a failing test result to be recorded. This method is useful
337
- * in the rare circumstances where the <code>assert<i>XXX</i></code>
338
- * methods can not be used, for example, when testing error
339
- * handling.<br>
340
- * <br />
341
- * The method below tests to confirm that a "gifts" product category can
342
- * be accessed through a <code>Catalog</code> instance.<br />
343
- *
344
- * <pre>
345
- * public function testGiftsProductCategoryAccess():Void {
346
- * var catalog:ProductCatalog = CatalogFactory.getCatalog("fall2005");
347
- *
348
- * // Try accessing the "gifts" product category.
349
- * try {
350
- * var products:Array = catalog.getProducts("gifts");
351
- * } catch (error:com.mycompany.errors.InvalidProductCategoryError) {
352
- * fail("catalog should contain 'gifts' products");
353
- * }
354
- * }
355
- * </pre>
356
- */
357
- public static function fail(msg:String):Void {
358
- throw new AssertionFailedError(msg);
359
- }
360
-
361
- // private static function failNotEquals(message:String, expected:Object, actual:Object):Void {
362
- // fail(format(message, expected, actual));
363
- // }
364
-
365
- private static function format(message:String, expected:Object, actual:Object):String {
366
- var formatted:String = "";
367
- if(message != null) {
368
- formatted = message + " ";
369
- }
370
- return formatted + "expected:<" + expected + "> but was:<" + actual + ">";
371
- }
372
-
373
- public static function failError(msg:String):Void {
374
- throw new IllegalOperationError(msg);
375
- }
376
- }
@@ -1,15 +0,0 @@
1
- import asunit.framework.Assert;
2
-
3
- class asunit.framework.AssertMock extends Assert {
4
-
5
- public function AssertMock() {
6
- }
7
-
8
- public function assertTrue():Void {
9
- Assert.assertTrue.apply(Assert, arguments);
10
- }
11
-
12
- public function assertEquals():Void {
13
- Assert.assertEquals.apply(arguments);
14
- }
15
- }