aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/sputnik_converted/13_Function_Definition/13.0_Chapter/S13.0_A5.js
blob: 2a633e9fc0ba4202abbc9ea347749831b5262a0d (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S13_A5;
* @section: 13, 10.1.2;
* @assertion: Only FormalParameterList as arguments list is allowed;
* @description: Trying to use [arg1, arg2, arg3], (arg1, arg2, arg3), etc. as a FormalParameterList; 
*/


// Converted for Test262 from original Sputnik source

ES5Harness.registerTest( {
id: "S13.0_A5",

path: "13_Function_Definition\13.0_Chapter\S13.0_A5.js",

assertion: "Only FormalParameterList as arguments list is allowed",

description: "Trying to use [arg1, arg2, arg3], (arg1, arg2, arg3), etc. as a FormalParameterList",

test: function testcase() {
   //////////////////////////////////////////////////////////////////////////////
//CHECK#1
try{
	eval("function __func([arg1, arg2, arg3]){return arguments.length;}");
	$ERROR('#1: eval("function __func([arg1, arg2, arg3]){return arguments.length;}") lead to throwing exception');
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#1.1: eval("function __func([arg1, arg2, arg3]){return arguments.length;}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
try{
	eval("function __func((arg1, arg2, arg3)){return arguments.length;}");
	$ERROR('#2: eval("function __func((arg1, arg2, arg3)){return arguments.length;}") lead to throwing exception')
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#2.1: eval("function __func((arg1, arg2, arg3)){return arguments.length;}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#3
try{
	eval("function __func(arg1, arg2, arg3,){return arguments.length;}");
	$ERROR('#3: eval("function __func(arg1, arg2, arg3,){return arguments.length;}") lead to throwing exception')
} catch(e){
	if(!(e instanceof SyntaxError)){
		$ERROR('#3.1: eval("function __func(arg1, arg2, arg3,){return arguments.length;}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
	}
}
//
//////////////////////////////////////////////////////////////////////////////

 }
});