mirror of
https://github.com/tc39/test262.git
synced 2025-08-29 05:48:28 +02:00
29 lines
633 B
JavaScript
29 lines
633 B
JavaScript
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/**
|
|
* The valueOf method returns its "this" value
|
|
*
|
|
* @path ch15/15.2/15.2.4/15.2.4.4/S15.2.4.4_A1_T3.js
|
|
* @description "this" value is a string
|
|
*/
|
|
|
|
//CHECK#1
|
|
if (typeof Object.prototype.valueOf !== "function") {
|
|
$ERROR('#1: valueOf method defined');
|
|
}
|
|
|
|
var obj=new Object("greenfield");
|
|
|
|
//CHECK#2
|
|
if (typeof obj.valueOf !== "function") {
|
|
$ERROR('#2: valueOf method accessed');
|
|
}
|
|
|
|
//CHECK#3
|
|
if (obj.valueOf()!=="greenfield") {
|
|
$ERROR('#3: The valueOf method returns its this value');
|
|
}
|
|
|
|
|