| 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 |
Result of primitive conversion from object is a default value for the |
| 7 |
Object |
| 8 |
es5id: 9.1_A1_T3 |
| 9 |
description: > |
| 10 |
Using operator "+". This operator firstly calls ToPrimitive and |
| 11 |
then calls ToString or ToNumber |
| 12 |
---*/ |
| 13 |
|
| 14 |
// CHECK#1 |
| 15 |
var object = {valueOf: function() {return 1}, toString: function() {return 0}}; |
| 16 |
if (object + "" !== "1") { |
| 17 |
$ERROR('#1: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object + "" === "1". Actual: ' + (object + "")); |
| 18 |
} |
| 19 |
|
| 20 |
// CHECK#2 |
| 21 |
var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; |
| 22 |
if (object + 0 !== "10") { |
| 23 |
$ERROR('#2: var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; object + 0 === "10". Actual: ' + (object + 0)); |
| 24 |
} |