-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathassert.js
823 lines (763 loc) · 23.9 KB
/
assert.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
/**
* @fileOverview Assertion library for unit testing.
* It implements the [CommonJS Unit Testing](http://wiki.commonjs.org/wiki/Unit_Testing/1.0)
* specification and adds some additional convenience methods.
*
* @example var assert = require('assert');
* assert.deepEqual({b: 2, a: 1}, {a: 1, b: 2});
* assert.isFalse(100 != 100);
* assert.isNotNull(undefined);
*
* @see The <code><a href="../test/index.html">test</a></code> module is a test runner for unit tests.
* It manages the execution of tests and provides the outcome to the user.
*/
export(
"AssertionError",
"ArgumentsError",
"fail",
// commonjs assertion methods
"ok",
"equal",
"notEqual",
"deepEqual",
"notDeepEqual",
"strictEqual",
"notStrictEqual",
"throws",
// custom assertion methods
"isTrue",
"isFalse",
"matches",
"stringContains",
"isNull",
"isNotNull",
"isUndefined",
"isNotUndefined",
"isNaN",
"isNotNaN"
);
var {
jsDump,
getType,
getStackTrace
} = require("./test");
/**
* @param {Object} args The arguments array.
* @param {Number} argsExpected The number of expected arguments
* @returns The comment appended to the expected arguments, if any
* @type String
*/
function evalArguments(args, argsExpected) {
if (!(args.length == argsExpected ||
(args.length == argsExpected + 1 && getType(args[args.length - 1]) == "string"))) {
throw new ArgumentsError("Insufficient arguments passed to assertion function");
}
return args[argsExpected];
};
/**
* Deep-compares both arguments.
*
* @param {Object} value1 The argument to be compared
* @param {Object} value2 The argument to be compared to
* @returns True if arguments are equal, false otherwise
* @type Boolean
*/
function isDeepEqual(value1, value2) {
if (value1 === value2) {
return true;
} else if (value1 instanceof Date && value2 instanceof Date) {
return value1.getTime() === value2.getTime();
} else if (typeof(value1) != "object" || typeof(value2) != "object") {
return value1 == value2;
} else {
return objectsAreEqual(value1, value2);
}
}
/**
* Returns true if the objects passed as argument are equal
* @param {Object} value1 The object to be compared
* @param {Object} value2 The object to be compared to
* @returns True if the objects are equal, false otherwise
* @type Boolean
*/
function objectsAreEqual(obj1, obj2) {
if (isNullOrUndefined(obj1) || isNullOrUndefined(obj2)) {
return false;
}
// the 1.0 spec (and Unittest/B) speaks of comparing the prototype
// property, which is only set for constructor functions (for instances
// it's undefined). plus only owned properties are compared, leading
// to two objects being equivalent even if their prototypes have
// different properties. instead using Object.getPrototypeOf()
// to compare the prototypes of two objects
// see also http://groups.google.com/group/commonjs/msg/501a7e3cd9a920e5
if (Object.getPrototypeOf(obj1) !== Object.getPrototypeOf(obj2)) {
return false;
}
// compare object keys (objects *and* arrays)
var keys1 = getOwnKeys(obj1);
var keys2 = getOwnKeys(obj2);
var propsAreEqual = keys1.length === keys2.length && keys1.every(function(name, idx) {
return name === keys2[idx] && isDeepEqual(obj1[name], obj2[name]);
});
if (propsAreEqual === false) {
return propsAreEqual;
}
// array comparison
if (getType(obj1) === "array") {
return obj1.length === obj2.length && obj1.every(function(value, idx) {
return isDeepEqual(value, obj2[idx]);
});
}
return true;
}
/**
* Returns true if the argument is null or undefined
* @param {Object} obj The object to test
* @returns True if the argument is null or undefined
* @type Boolean
*/
function isNullOrUndefined(obj) {
return obj === null || obj === undefined;
}
/**
* Returns the names of owned properties of the object passed as argument.
* Note that this only includes those properties for which hasOwnProperty
* returns true
* @param {Object} obj The object to return its propery names for
* @returns The property names
* @type Array
*/
function getOwnKeys(obj) {
return [key for (key in obj) if (Object.prototype.hasOwnProperty.call(obj, key))].sort();
}
/**
* Basic failure method. Fails an assertion without checking any preconditions.
*
* @param {Object|String} options An object containing optional "message", "actual"
* and "expected" properties, or alternatively a message string
* @throws AssertionError
* @example // a complex condition
* if (a === true && (b === "complex" || ...)) {
* assert.fail("This should not be reached!");
* }
*/
function fail(options) {
throw new AssertionError(options);
}
/**
* Prepends the comment to the message, if given
* @returns The message
* @type String
*/
function prependComment(message, comment) {
if (getType(comment) === "string" && comment.length > 0) {
return comment + "\n" + message;
}
return message;
}
/***************************
***** E R R O R S *****
***************************/
/**
* Constructs a new AssertionError instance
* @class Instances of this class represent an assertion error
* @param {Object} options An object containing error details
* @param.message {String} The error message
* @param.actual {Object} The actual value
* @param.expected {Object} The expected value
* @constructor
* @augments Error
*/
function AssertionError(options) {
// accept a single string argument
if (getType(options) === "string") {
options = {
"message": options
};
}
var stackTrace = getStackTrace();
Object.defineProperty(this, "name", {
get: function() {
return "AssertionError";
}
});
Object.defineProperty(this, "message", {
get: function() {
return options.message;
}
});
Object.defineProperty(this, "actual", {
get: function() {
return options.actual;
}
});
Object.defineProperty(this, "expected", {
get: function() {
return options.expected;
}
});
Object.defineProperty(this, "stackTrace", {
get: function() {
return stackTrace;
}
});
return this;
};
/** @ignore */
AssertionError.prototype = new Error();
/** @ignore */
AssertionError.toString = function() {
return "[AssertionError]";
};
/** @ignore */
AssertionError.prototype.toString = function() {
return "[AssertionError '" + this.message + "']";
};
/**
* Creates a new ArgumentsError instance
* @class Instances of this class represent an error thrown if insufficient
* arguments have been passed to an assertion function
* @param {String} message The exception message
* @returns A newly created ArgumentsError instance
* @constructor
*/
function ArgumentsError(message) {
var stackTrace = getStackTrace();
Object.defineProperty(this, "message", {
get: function() {
return message;
}
});
Object.defineProperty(this, "stackTrace", {
get: function() {
return stackTrace;
}
});
return this;
};
/** @ignore */
ArgumentsError.prototype = new Error();
/** @ignore */
ArgumentsError.toString = function() {
return "[ArgumentsError]";
};
/** @ignore */
ArgumentsError.prototype.toString = function() {
return "[ArgumentsError '" + this.message + "']";
};
/*******************************************************************
***** C O M M O N J S A S S E R T I O N M E T H O D S *****
*******************************************************************/
/**
* Checks if the value passed as argument is truthy.
*
* @example // passing assertions
* assert.ok(true);
* assert.ok("1");
* assert.ok([]);
* assert.ok({});
* assert.ok(new Boolean(false));
* assert.ok(Infinity);<br>
* // failing assertions
* assert.ok(0);
* assert.ok(false);
* assert.ok(null);
* assert.ok(undefined);
* assert.ok("");
*
* @param {Object} value The value to check for truthiness
* @throws ArgumentsError
* @throws AssertionError
*/
function ok(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (!!value === false) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be truthy", comment),
"actual": value,
"expected": true
});
}
return;
}
/**
* Performs a non-strict comparison with the simple comparison operator
* <code>==</code> to check if the values are equal. When they are equal,
* the assertion passes, otherwise it fails.
*
* @example // truthy conditionals
* assert.equal(true, true);
* assert.equal(true, "1");<br>
* // falsy conditionals
* assert.equal(false, false);
* assert.equal(false, "");
* assert.equal(false, "0");
* assert.equal(null, undefined);
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function equal(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (actual != expected) {
fail({
"message": prependComment("Expected " + jsDump(expected) + ", got " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Performs a non-strict comparison with the simple comparison operator
* <code>!=</code> to check if the values are not equal.
* When they are not equal, the assertion passes, otherwise it fails.
*
* @example // passing assertions
* assert.notEqual(true, false);
* assert.notEqual(1, 2);
* assert.notEqual(false, NaN);
* assert.notEqual(null, NaN);
* assert.notEqual(undefined, NaN);
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function notEqual(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (actual == expected) {
fail({
"message": prependComment("Expected different value than " + jsDump(expected) +
", got equivalent value " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Performs a deep recursive comparison of objects. It is equivalent to
* <code>equal()</code>. If an object's property holds a non-object type,
* it performs a non-strict comparison. Instances of <code>Date</code> are
* compared with <code>getTime()</code> according to universal time.
*
* @example // passing assertions
* assert.deepEqual(5, "5");
* assert.deepEqual(
* { time: new Date(2010, 5, 14) },
* { "time": new Date(2010, 5, 14) }
* );
* assert.deepEqual([1, 2, 3], ["1", "2", "3"]);
* assert.deepEqual({"one": 1, "two": 2}, {"two": "2", "one": "1"});
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function deepEqual(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (isDeepEqual(actual, expected) === false) {
fail({
"message": prependComment("Expected " + jsDump(expected) + ", got " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Performs a deep recursive comparison of objects. The comparison
* is equivalent to <code>notEqual()</code>.
*
* @example // passing assertions
* assert.notDeepEqual(
* { "time": new Date(2010, 5, 14) },
* { "time": new Date(2010, 5, 15) }
* );
* assert.notDeepEqual([1, 2, 3, 4], ["1", "2", "3"]);
* assert.notDeepEqual({"one": 1, "two": 2}, {"three": "3", "one": "1"});
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function notDeepEqual(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (isDeepEqual(actual, expected) === true) {
fail({
"message": prependComment("Expected different value than " + jsDump(expected) +
", got deep equal value " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Performs a strict comparison with the strict equality operator <code>===</code>.
* When the values are equal in type and value, the assertion passes,
* otherwise it fails.
*
* @example // passing assertions
* assert.strictEqual(null, null);
* assert.strictEqual(undefined, undefined);
* assert.strictEqual(1, 1);
* assert.strictEqual("1", "1");
* assert.strictEqual(true, true);<br>
* // passing assertion
* var obj = {};
* assert.strictEqual(obj, obj);<br>
* // failing assertions
* assert.strictEqual(null, undefined);
* assert.strictEqual(true, "1");
* assert.strictEqual(false, "");
* assert.strictEqual(false, "0");
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function strictEqual(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (actual !== expected) {
fail({
"message": prependComment("Expected " + jsDump(expected) + ", got " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Performs a strict comparison with the strict inequality operator <code>!==</code>.
* When the values are inequal in type and value, the assertion passes,
* otherwise it fails.
*
* @example // passing assertions
* assert.notStrictEqual(null, undefined);
* assert.notStrictEqual(1, "1");
* assert.notStrictEqual(true, false);
*
* @param {Object} actual The actual value
* @param {Object} expected The expected value
* @throws ArgumentsError
* @throws AssertionError
*/
function notStrictEqual(actual, expected) {
var comment = evalArguments(arguments, arguments.callee.length);
if (actual === expected) {
fail({
"message": prependComment("Expected different value than " + jsDump(expected) +
", got strictly equal value " + jsDump(actual), comment),
"actual": actual,
"expected": expected
});
}
return;
}
/**
* Checks if the function passed as argument throws a defined exception.
* It can also assert certain Java exceptions thrown by the function.
*
* @example var foo = function() { throw "foo"; };
* var bar = function() { (new java.util.Vector()).get(0); }<br>
* // passes
* assert.throws(foo, "foo");<br>
* // fails
* assert.throws(foo, "bar");<br>
* // checks for a Java runtime exception, passes
* assert.throws(bar, java.lang.ArrayIndexOutOfBoundsException);
*
* @param {Object} func The function to call
* @param {Object} expectedError Optional object expected to be thrown when executing
* the function
* @throws ArgumentsError
* @throws AssertionError
*/
function throws(func, expectedError) {
if (!(func instanceof Function)) {
throw new ArgumentsError("First argument to throws() must be a function");
}
try {
func();
} catch (e) {
var isExpected = false;
var thrown = e;
if (expectedError == null) {
// accept everything
isExpected = true;
} else if (expectedError != null && e != null) {
// check if exception is the one expected
switch (typeof(expectedError)) {
case "string":
isExpected = (e.name === expectedError || e === expectedError);
break;
case "function":
// this is true for all JS constructors and Java classes!
isExpected = (e instanceof expectedError ||
(thrown = e.rhinoException) instanceof expectedError ||
(thrown = e.javaException) instanceof expectedError);
break;
case "number":
case "boolean":
default:
isExpected = (e === expectedError);
break;
}
}
if (!isExpected) {
fail({
"message": "Expected " + jsDump(expectedError) +
" to be thrown, but got " + jsDump(e) + " instead",
"actual": e,
"expected": expectedError
});
}
return;
}
if (expectedError != null) {
fail("Expected exception " + jsDump(expectedError) + " to be thrown");
}
fail("Expected exception to be thrown");
}
/***************************************************************
***** C U S T O M A S S E R T I O N M E T H O D S *****
***************************************************************/
/**
* Checks if the value passed as argument is boolean true using <code>===</code>.
*
* @example // passing assertion
* assert.isTrue(100 == 100);<br>
* // failing assertion
* assert.isTrue(100 != 100);
*
* @param {Object} val The value that should be boolean true.
* @throws ArgumentsError
* @throws AssertionError
*/
function isTrue(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (getType(value) !== "boolean") {
throw new ArgumentsError("Invalid argument to assertTrue(boolean): " +
jsDump(value));
} else if (value !== true) {
fail({
"message": prependComment("Expected true, got " + jsDump(value), comment),
"actual": value,
"expected": true
});
}
return;
}
/**
* Checks if the value passed as argument is strict boolean false using <code>===</code>.
*
* @example // passing assertion
* assert.isFalse(100 != 100);<br>
* // failing assertion
* assert.isFalse(100 == 100);
*
* @param {Object} val The value that should be boolean false.
* @throws ArgumentsError
* @throws AssertionError
*/
function isFalse(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (getType(value) !== "boolean") {
throw new ArgumentsError("Invalid argument to assertFalse(boolean): " +
jsDump(value));
} else if (value === true) {
fail({
"message": prependComment("Expected false, got " + jsDump(value), comment),
"actual": value,
"expected": false
});
}
return;
}
/**
* Checks if the value passed as argument is strict null using <code>===</code>.
*
* @example // passing assertion
* assert.isNull(null);<br>
* // failing assertions
* assert.isNull(undefined);
* assert.isNull("");
*
* @param {Object} val The value that should be null.
* @throws ArgumentsError
* @throws AssertionError
*/
function isNull(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (value !== null) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be null", comment),
"actual": value,
"expected": null
});
}
return;
}
/**
* Checks if the value passed as argument is strict not null using <code>===</code>.
*
* @example // passing assertions
* assert.isNotNull(undefined);
* assert.isNotNull("passes");<br>
* // failing assertion
* assert.isNotNull(null);
*
* @param {Object} val The value that should be not null.
* @throws ArgumentsError
* @throws AssertionError
*/
function isNotNull(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (value === null) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be not null", comment),
"actual": value,
});
}
return;
}
/**
* Checks if the value passed as argument is strict undefined using <code>===</code>.
*
* @example // passing assertion
* assert.isUndefined(undefined);<br>
* // failing assertions
* assert.isUndefined(null);
* assert.isUndefined("");
*
* @param {Object} val The value that should be undefined.
* @throws ArgumentsError
* @throws AssertionError
*/
function isUndefined(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (value !== undefined) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be undefined", comment),
"actual": value,
"expected": undefined
});
}
return;
}
/**
* Checks if the value passed as argument is not undefined using <code>===</code>.
*
* @example // passing assertions
* assert.isNotUndefined(null);
* assert.isNotUndefined("passes");<br>
* // failing assertion
* assert.isNotUndefined(undefined);
*
* @param {Object} val The value that should be not undefined.
* @throws ArgumentsError
* @throws AssertionError
*/
function isNotUndefined(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (value === undefined) {
fail({
"message": prependComment("Expected argument to be not undefined", comment),
"actual": value,
});
}
return;
}
/**
* Asserts that the value passed as argument is NaN.
* Uses <code>global.isNaN()</code> for the check.
* @param {Object} val The value that should be NaN.
* @throws ArgumentsError
* @throws AssertionError
*/
function isNaN(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (global.isNaN(value) === false) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be NaN", comment),
"actual": value,
"expected": NaN
});
}
return;
}
/**
* Checks if the value passed as argument is not NaN.
* Uses <code>global.isNaN()</code> for the check.
* @param {Object} val The value that should be not NaN.
* @throws ArgumentsError
* @throws AssertionError
*/
function isNotNaN(value) {
var comment = evalArguments(arguments, arguments.callee.length);
if (global.isNaN(value) === true) {
fail({
"message": prependComment("Expected " + jsDump(value) + " to be a number", comment),
"actual": value,
"expected": Number
});
}
return;
}
/**
* Checks if the value passed as argument contains the pattern specified.
*
* @example assert.stringContains("this will pass", "pass");
* assert.stringContains("this will fail", "pass");
*
* @param {String} value The string that should contain the pattern
* @param {String} pattern The string that should be contained
* @throws ArgumentsError
* @throws AssertionError
*/
function stringContains(value, pattern) {
var comment = evalArguments(arguments, arguments.callee.length);
if (getType(pattern) === "string") {
if (value.indexOf(pattern) < 0) {
fail(prependComment("Expected string " + jsDump(pattern) +
" to be found in " + jsDump(value), comment));
}
} else {
throw new ArgumentsError("Invalid argument to assertStringContains(string, string):\n" +
jsDump(pattern));
}
return;
}
/**
* Checks if the regular expression matches the string.
*
* @example assert.matches("this will pass", /p.?[s]{2}/);
* assert.matches("this will fail", /[0-9]+/);
*
* @param {String} value The string that should contain the regular expression pattern
* @param {RegExp} expr The regular expression that should match the value
* @throws ArgumentsError
* @throws AssertionError
*/
function matches(value, expr) {
var comment = evalArguments(arguments, arguments.callee.length);
if (getType(expr) === "regexp") {
if (expr.test(value) == false) {
fail(prependComment("Expected pattern " + jsDump(expr) + " to match " +
jsDump(value), comment));
}
} else {
throw new ArgumentsError("Invalid argument to assertMatch(string, regexp):\n" +
jsDump(expr));
}
return;
}