|
1 // Any copyright is dedicated to the Public Domain. |
|
2 // http://creativecommons.org/licenses/publicdomain/ |
|
3 |
|
4 var BUGNUMBER = 373118; |
|
5 var summary = |
|
6 'Properly handle explicitly-undefined optional arguments to a bunch of ' + |
|
7 'functions'; |
|
8 |
|
9 print(BUGNUMBER + ": " + summary); |
|
10 |
|
11 //----------------------------------------------------------------------------- |
|
12 |
|
13 var a; |
|
14 |
|
15 a = "abc".slice(0, undefined); |
|
16 assertEq(a, "abc"); |
|
17 |
|
18 a = "abc".substr(0, undefined); |
|
19 assertEq(a, "abc"); |
|
20 |
|
21 a = "abc".substring(0, undefined); |
|
22 assertEq(a, "abc"); |
|
23 |
|
24 a = [1, 2, 3].slice(0, undefined); |
|
25 assertEq(a.join(), '1,2,3'); |
|
26 |
|
27 a = [1, 2, 3].sort(undefined); |
|
28 assertEq(a.join(), '1,2,3'); |
|
29 |
|
30 assertEq((20).toString(undefined), '20'); |
|
31 |
|
32 //----------------------------------------------------------------------------- |
|
33 |
|
34 reportCompare(true, true); |