js/src/tests/test262/ch10/10.2/10.2.1/S10.2.1_A4_T1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch10/10.2/10.2.1/S10.2.1_A4_T1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * Function declaration in function code - If the variable object
     1.9 + * already has a property with the name of Function Identifier, replace its
    1.10 + * value and attributes. Semantically, this step must follow the creation of
    1.11 + * FormalParameterList properties
    1.12 + *
    1.13 + * @path ch10/10.2/10.2.1/S10.2.1_A4_T1.js
    1.14 + * @description Checking existence of a function with passed parameter
    1.15 + * @noStrict
    1.16 + */
    1.17 +
    1.18 +//CHECK#1
    1.19 +function f1(x){
    1.20 +  return x;
    1.21 +
    1.22 +  function x(){
    1.23 +    return 7;
    1.24 +  }
    1.25 +}
    1.26 +if(!(f1().constructor.prototype === Function.prototype)){
    1.27 +  $ERROR('#1: f1() returns function');
    1.28 +}
    1.29 +
    1.30 +//CHECK#2
    1.31 +function f2(x){
    1.32 +  return typeof x;
    1.33 +
    1.34 +  function x(){
    1.35 +    return 7;
    1.36 +  }
    1.37 +}
    1.38 +if(!(f2() === "function")){
    1.39 +  $ERROR('#2: f2() === "function"');
    1.40 +}
    1.41 +
    1.42 +//CHECK#3
    1.43 +function f3() {
    1.44 +  return typeof arguments;
    1.45 +  function arguments() {
    1.46 +    return 7;
    1.47 +  }
    1.48 +}
    1.49 +if (!(f3() === "function")){
    1.50 +  $ERROR('#3: f3() === "function"');
    1.51 +}
    1.52 +

mercurial