summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch13/13.0/S13_A7_T2.js
blob: 6b381b79430a9572a8978b09ab26ce2b3c3b0025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * The FunctionBody must be SourceElements
 *
 * @path ch13/13.0/S13_A7_T2.js
 * @description Inserting elements that is different from SourceElements into the FunctionBody
 */

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try{
	eval("function __func(){/ ABC}");
	$ERROR('#1: eval("function __func(){/ ABC}") lead to throwing exception');
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#1.1: eval("function __func(){/ ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#3
try{
	eval("function __func(){&1}");
	$ERROR('#3: eval("function __func(){&1}") lead to throwing exception');
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#3.1: eval("function __func(){&1}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#4
try{
	eval("function __func(){# ABC}");
	$ERROR('#4: eval("function __func(){# ABC}") lead to throwing exception');
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#4.1: eval("function __func(){# ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////