mirror of https://github.com/tc39/test262.git
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/**
|
|
* @name: S14_D4_T1;
|
|
* @section: 14;
|
|
* @assertion: Function declaration may be inside of try-catch block ;
|
|
*/
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//CHECK#1
|
|
if (typeof __sleep !== "function") {
|
|
$FAIL('#1: Test fails badly');
|
|
}
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//CHECK#2
|
|
try{
|
|
__sleep();
|
|
$ERROR('#2: Function declaration may be inside of try-catch block');
|
|
} catch(e){
|
|
$PRINT("#2 passed "+e.message);
|
|
}
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
try {
|
|
function __sleep(){
|
|
return CHUNK;
|
|
}
|
|
} catch (e) {
|
|
;
|
|
}
|
|
|
|
|
|
CHUNK="zzz...";
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//CHECK#3
|
|
try{
|
|
if (__sleep()!=="zzz...") {
|
|
$ERROR('#3: Function declaration may be inside of try-catch block');
|
|
}
|
|
} catch(e){
|
|
$ERROR('#3.1: Function declaration may be inside of try-catch block');
|
|
}
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|