| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
When String is called as a function rather than as a constructor, it |
| 7 |
performs a type conversion |
| 8 |
es5id: 15.5.1.1_A1_T17 |
| 9 |
description: > |
| 10 |
Call String() with numbers that have more than 1 significant digit |
| 11 |
after point |
| 12 |
---*/ |
| 13 |
|
| 14 |
var __str = String(1.2345); |
| 15 |
|
| 16 |
////////////////////////////////////////////////////////////////////////////// |
| 17 |
//CHECK#1 |
| 18 |
if (typeof __str !== "string") { |
| 19 |
throw new Test262Error('#1: __str = String(1.2345); typeof __str === "string". Actual: typeof __str ===' + typeof __str); |
| 20 |
} |
| 21 |
// |
| 22 |
////////////////////////////////////////////////////////////////////////////// |
| 23 |
|
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
//CHECK#2 |
| 26 |
if (__str !== "1.2345") { |
| 27 |
throw new Test262Error('#2: __str = String(1.2345); __str === "1.2345". Actual: __str ===' + __str); |
| 28 |
} |
| 29 |
// |
| 30 |
////////////////////////////////////////////////////////////////////////////// |
| 31 |
|
| 32 |
__str = String(1.234567890); |
| 33 |
|
| 34 |
////////////////////////////////////////////////////////////////////////////// |
| 35 |
//CHECK#3 |
| 36 |
if (typeof __str !== "string") { |
| 37 |
throw new Test262Error('#3: __str = String(1.234567890); typeof __str === "string". Actual: typeof __str ===' + typeof __str); |
| 38 |
} |
| 39 |
// |
| 40 |
////////////////////////////////////////////////////////////////////////////// |
| 41 |
|
| 42 |
////////////////////////////////////////////////////////////////////////////// |
| 43 |
//CHECK#4 |
| 44 |
if (__str !== "1.23456789") { |
| 45 |
throw new Test262Error('#4: __str = String(1.234567890); __str === "1.23456789". Actual: __str ===' + __str); |
| 46 |
} |
| 47 |
// |
| 48 |
////////////////////////////////////////////////////////////////////////////// |
| 49 |
|
| 50 |
__str = String(1.234500000000000000000000000); |
| 51 |
|
| 52 |
////////////////////////////////////////////////////////////////////////////// |
| 53 |
//CHECK#5 |
| 54 |
if (typeof __str !== "string") { |
| 55 |
throw new Test262Error('#5: __str = String(1.234500000000000000000000000); typeof __str === "string". Actual: typeof __str ===' + typeof __str); |
| 56 |
} |
| 57 |
// |
| 58 |
////////////////////////////////////////////////////////////////////////////// |
| 59 |
|
| 60 |
////////////////////////////////////////////////////////////////////////////// |
| 61 |
//CHECK#6 |
| 62 |
if (__str !== "1.2345") { |
| 63 |
throw new Test262Error('#6: __str = String(1.234500000000000000000000000); __str === "1.2345". Actual: __str ===' + __str); |
| 64 |
} |
| 65 |
// |
| 66 |
////////////////////////////////////////////////////////////////////////////// |
| 67 |
|
| 68 |
reportCompare(0, 0); |