André Bargull 0dbafac5a6 Add 'var' declarations for strict mode
This change adds 'var' declarations for global variables to allow the tests to run in strict mode (see issue #35).
Extra care was taken to ensure the changes do not alter the test behavior, for example when implicit creation of global variables are part of the test.
Note: The change does not fix all strict mode errors due to missing 'var' declarations.
2014-12-10 16:37:05 -08:00

43 lines
1.4 KiB
JavaScript

// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
The production IterationStatement: "for (var VariableDeclarationNoIn in
Expression) Statement"
es5id: 12.6.4_A6
description: >
Using Object with custom prototype as an Expression is
appropriate. The prototype is "{feat:2,hint:"protohint"}"
---*/
var __accum, key;
function FACTORY(){this.prop=1;this.hint="hinted"};
FACTORY.prototype = {feat:2,hint:"protohint"};
var __instance = new FACTORY;
__accum="";
for (key in __instance){
__accum+=(key + __instance[key]);
}
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) {
$ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)');
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__accum.indexOf("hintprotohint")!==-1) {
$ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") );
}
//
//////////////////////////////////////////////////////////////////////////////