Created
December 15, 2015 21:34
-
-
Save avdg/573524fa9b3071eeb7b8 to your computer and use it in GitHub Desktop.
UglifyJS2 test262 argument object crash test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Ecma International. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
es5id: 10.6-6-3 | |
description: > | |
'length' property of arguments object for 0 argument function | |
exists | |
flags: [noStrict] | |
---*/ | |
function testcase() { | |
var arguments= undefined; | |
(function () { assert.sameValue(arguments.length, 0); })(); | |
} | |
testcase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test262Error(t){this.message=t||""}function testFailed(t){$ERROR(t)}function testRun(t,r,e,o,n,a){if("pass"!==n)throw new Error("Test '"+r+"'failed: "+a)}function assert(t,r){t!==!0&&(void 0===r&&(r="Expected true but got "+String(t)),$ERROR(r))}function testcase(){var t=void 0;!function(){assert.sameValue(t.length,0)}()}var strict_mode=!1,NotEarlyErrorString="NotEarlyError",EarlyErrorRePat="^((?!"+NotEarlyErrorString+").)*$",NotEarlyError=new Error(NotEarlyErrorString);Test262Error.prototype.toString=function(){return"Test262Error: "+this.message};var $ERROR;$ERROR=function(t){throw new Test262Error(t)};var print;if("object"==typeof console&&(print=function(){var t=Array.prototype.slice.call(arguments);console.log(t.join(" "))}),"object"==typeof WScript){print=function(){var t=Array.prototype.slice.call(arguments);WScript.Echo(t.join(" "))};var oldError=$ERROR;$ERROR=function(t){print("Test262 Error: "+t),WScript.Quit(1)}}assert._isSameValue=function(t,r){return t===r?0!==t||1/t===1/r:t!==t&&r!==r},assert.sameValue=function(t,r,e){assert._isSameValue(t,r)||(void 0===e?e="":e+=" ",e+="Expected SameValue(«"+String(t)+"», «"+String(r)+"») to be true",$ERROR(e))},assert.notSameValue=function(t,r,e){assert._isSameValue(t,r)&&(void 0===e?e="":e+=" ",e+="Expected SameValue(«"+String(t)+"», «"+String(r)+"») to be false",$ERROR(e))},assert["throws"]=function(t,r,e){if(void 0===r)return void $ERROR("assert.throws requires two arguments: the error constructor and a function to run");void 0===e?e="":e+=" ";try{r()}catch(o){return void("object"!=typeof o||null===o?(e+="Thrown value was not an object!",$ERROR(e)):o.constructor!==t&&(e+="Expected a "+t.name+" but got a "+o.constructor.name,$ERROR(e)))}e+="Expected a "+t.name+" to be thrown but no exception was thrown at all",$ERROR(e)},testcase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Ecma International. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
es5id: 10.6-6-4 | |
description: > | |
'length' property of arguments object for 0 argument function call | |
is 0 even with formal parameters | |
---*/ | |
function testcase(a,b,c) { | |
assert.sameValue(arguments.length, 0); | |
} | |
testcase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test262Error(t){this.message=t||""}function testFailed(t){$ERROR(t)}function testRun(t,r,e,o,n,a){if("pass"!==n)throw new Error("Test '"+r+"'failed: "+a)}function assert(t,r){t!==!0&&(void 0===r&&(r="Expected true but got "+String(t)),$ERROR(r))}function testcase(){var t=void 0;!function(r,e,o){assert.sameValue(t.length,0)}()}var strict_mode=!1,NotEarlyErrorString="NotEarlyError",EarlyErrorRePat="^((?!"+NotEarlyErrorString+").)*$",NotEarlyError=new Error(NotEarlyErrorString);Test262Error.prototype.toString=function(){return"Test262Error: "+this.message};var $ERROR;$ERROR=function(t){throw new Test262Error(t)};var print;if("object"==typeof console&&(print=function(){var t=Array.prototype.slice.call(arguments);console.log(t.join(" "))}),"object"==typeof WScript){print=function(){var t=Array.prototype.slice.call(arguments);WScript.Echo(t.join(" "))};var oldError=$ERROR;$ERROR=function(t){print("Test262 Error: "+t),WScript.Quit(1)}}assert._isSameValue=function(t,r){return t===r?0!==t||1/t===1/r:t!==t&&r!==r},assert.sameValue=function(t,r,e){assert._isSameValue(t,r)||(void 0===e?e="":e+=" ",e+="Expected SameValue(«"+String(t)+"», «"+String(r)+"») to be true",$ERROR(e))},assert.notSameValue=function(t,r,e){assert._isSameValue(t,r)&&(void 0===e?e="":e+=" ",e+="Expected SameValue(«"+String(t)+"», «"+String(r)+"») to be false",$ERROR(e))},assert["throws"]=function(t,r,e){if(void 0===r)return void $ERROR("assert.throws requires two arguments: the error constructor and a function to run");void 0===e?e="":e+=" ";try{r()}catch(o){return void("object"!=typeof o||null===o?(e+="Thrown value was not an object!",$ERROR(e)):o.constructor!==t&&(e+="Expected a "+t.name+" but got a "+o.constructor.name,$ERROR(e)))}e+="Expected a "+t.name+" to be thrown but no exception was thrown at all",$ERROR(e)},testcase(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment