Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * The initial value of the created property length is the number |
michael@0 | 6 | * of actual parameter values supplied by the caller |
michael@0 | 7 | * |
michael@0 | 8 | * @path ch10/10.6/S10.6_A6.js |
michael@0 | 9 | * @description Create function, that returned arguments.length |
michael@0 | 10 | */ |
michael@0 | 11 | |
michael@0 | 12 | function f1(){ |
michael@0 | 13 | return arguments.length; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | //CHECK#1 |
michael@0 | 17 | if(!(f1() === 0)){ |
michael@0 | 18 | $ERROR('#1: argument.length === 0'); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | //CHECK#2 |
michael@0 | 22 | if(!(f1(0) === 1)){ |
michael@0 | 23 | $ERROR('#2: argument.length === 1'); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | //CHECK#3 |
michael@0 | 27 | if(!(f1(0, 1) === 2)){ |
michael@0 | 28 | $ERROR('#3: argument.length === 2'); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | //CHECK#4 |
michael@0 | 32 | if(!(f1(0, 1, 2) === 3)){ |
michael@0 | 33 | $ERROR('#4: argument.length === 3'); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | //CHECK#5 |
michael@0 | 37 | if(!(f1(0, 1, 2, 3) === 4)){ |
michael@0 | 38 | $ERROR('#5: argument.length === 4'); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | var f2 = function(){return arguments.length;}; |
michael@0 | 42 | |
michael@0 | 43 | //CHECK#6 |
michael@0 | 44 | if(!(f2() === 0)){ |
michael@0 | 45 | $ERROR('#6: argument.length === 0'); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | //CHECK#7 |
michael@0 | 49 | if(!(f2(0) === 1)){ |
michael@0 | 50 | $ERROR('#7: argument.length === 1'); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | //CHECK#8 |
michael@0 | 54 | if(!(f2(0, 1) === 2)){ |
michael@0 | 55 | $ERROR('#8: argument.length === 2'); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | //CHECK#9 |
michael@0 | 59 | if(!(f2(0, 1, 2) === 3)){ |
michael@0 | 60 | $ERROR('#9: argument.length === 3'); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | //CHECK#10 |
michael@0 | 64 | if(!(f2(0, 1, 2, 3) === 4)){ |
michael@0 | 65 | $ERROR('#10: argument.length === 4'); |
michael@0 | 66 | } |
michael@0 | 67 |