8057678: Tests for let and const keywords in Nashorn

Mon, 08 Sep 2014 15:37:50 +0400

author
yan
date
Mon, 08 Sep 2014 15:37:50 +0400
changeset 995
33bde22b7740
parent 994
f5be4bdd0f6e
child 996
f01257b46cf1

8057678: Tests for let and const keywords in Nashorn
Reviewed-by: hannesw, lagergren
Contributed-by: Sergey Lugovoy <sergey.lugovoy@oracle.com>

test/script/basic/es6/const-redeclare-extra.js file | annotate | diff | comparison | revisions
test/script/basic/es6/const-redeclare-extra.js.EXPECTED file | annotate | diff | comparison | revisions
test/script/basic/es6/let-redeclare-extra.js file | annotate | diff | comparison | revisions
test/script/basic/es6/let-redeclare-extra.js.EXPECTED file | annotate | diff | comparison | revisions
test/script/basic/es6/let_const_closure.js file | annotate | diff | comparison | revisions
test/script/basic/es6/let_const_closure.js.EXPECTED file | annotate | diff | comparison | revisions
test/script/basic/es6/let_const_reuse.js file | annotate | diff | comparison | revisions
test/script/basic/es6/let_const_reuse.js.EXPECTED file | annotate | diff | comparison | revisions
test/script/basic/es6/let_different_types.js file | annotate | diff | comparison | revisions
test/script/basic/es6/let_different_types.js.EXPECTED file | annotate | diff | comparison | revisions
test/script/basic/es6/let_loops.js file | annotate | diff | comparison | revisions
test/script/basic/es6/let_loops.js.EXPECTED file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/script/basic/es6/const-redeclare-extra.js	Mon Sep 08 15:37:50 2014 +0400
     1.3 @@ -0,0 +1,59 @@
     1.4 +/*
     1.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + * 
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + * 
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + * 
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + * 
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +/**
    1.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
    1.29 + *
    1.30 + * @test
    1.31 + * @run
    1.32 + * @option --language=es6
    1.33 + * @option -scripting
    1.34 + */
    1.35 +
    1.36 +
    1.37 +function tryIt (code) {
    1.38 +    try {
    1.39 +        eval(code)
    1.40 +    } catch (e) {
    1.41 +        print(e)
    1.42 +    }
    1.43 +}
    1.44 +
    1.45 +tryIt(<<CODE
    1.46 +    "use strict";
    1.47 +    const x = 2;
    1.48 +    var x = {};
    1.49 +CODE)
    1.50 +
    1.51 +tryIt(<<CODE
    1.52 +    "use strict";
    1.53 +    var x = 2;
    1.54 +    const x = {};
    1.55 +CODE)
    1.56 +
    1.57 +tryIt(<<CODE
    1.58 +    "use strict";
    1.59 +    function x () {}
    1.60 +    const x = 5;
    1.61 +CODE)
    1.62 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/script/basic/es6/const-redeclare-extra.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
     2.3 @@ -0,0 +1,9 @@
     2.4 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@2:3:8 Variable "x" has already been declared
     2.5 +    var x = {};
     2.6 +        ^
     2.7 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:8 Variable "x" has already been declared
     2.8 +    var x = 2;
     2.9 +        ^
    2.10 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:13 Variable "x" has already been declared
    2.11 +    function x () {}
    2.12 +             ^
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/script/basic/es6/let-redeclare-extra.js	Mon Sep 08 15:37:50 2014 +0400
     3.3 @@ -0,0 +1,70 @@
     3.4 +/*
     3.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + * 
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + * 
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + * 
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + * 
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + */
    3.26 +
    3.27 +/**
    3.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
    3.29 + *
    3.30 + * @test
    3.31 + * @run
    3.32 + * @option --language=es6
    3.33 + * @option -scripting
    3.34 + */
    3.35 +
    3.36 +function tryIt (code) {
    3.37 +    try {
    3.38 +        eval(code)
    3.39 +    } catch (e) {
    3.40 +        print(e)
    3.41 +    }
    3.42 +}
    3.43 +
    3.44 +tryIt(<<CODE
    3.45 +    "use strict";
    3.46 +    let x = 2;
    3.47 +    const x = function (a,b,c) {};
    3.48 +CODE)
    3.49 +
    3.50 +tryIt(<<CODE
    3.51 +    "use strict";
    3.52 +    let x = {};
    3.53 +    var x = 2;
    3.54 +CODE)
    3.55 +
    3.56 +tryIt(<<CODE
    3.57 +    "use strict";
    3.58 +    var x = 2;
    3.59 +    let x = undefined;
    3.60 +CODE)
    3.61 +
    3.62 +tryIt(<<CODE
    3.63 +    "use strict";
    3.64 +    const x = function (){};
    3.65 +    let x = {};
    3.66 +CODE)
    3.67 +
    3.68 +
    3.69 +tryIt(<<CODE
    3.70 +    "use strict";
    3.71 +    let a = 2;
    3.72 +    function a () {};
    3.73 +CODE)
    3.74 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/script/basic/es6/let-redeclare-extra.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
     4.3 @@ -0,0 +1,15 @@
     4.4 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@2:2:8 Variable "x" has already been declared
     4.5 +    let x = 2;
     4.6 +        ^
     4.7 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:8 Variable "x" has already been declared
     4.8 +    var x = 2;
     4.9 +        ^
    4.10 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:8 Variable "x" has already been declared
    4.11 +    var x = 2;
    4.12 +        ^
    4.13 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:10 Variable "x" has already been declared
    4.14 +    const x = function (){};
    4.15 +          ^
    4.16 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:13 Variable "a" has already been declared
    4.17 +    function a () {};
    4.18 +             ^
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/script/basic/es6/let_const_closure.js	Mon Sep 08 15:37:50 2014 +0400
     5.3 @@ -0,0 +1,123 @@
     5.4 +/*
     5.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.
    5.11 + *
    5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 + * version 2 for more details (a copy is included in the LICENSE file that
    5.16 + * accompanied this code).
    5.17 + *
    5.18 + * You should have received a copy of the GNU General Public License version
    5.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 + *
    5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.23 + * or visit www.oracle.com if you need additional information or have any
    5.24 + * questions.
    5.25 + */
    5.26 +
    5.27 +/**
    5.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
    5.29 + *
    5.30 + * @test
    5.31 + * @run
    5.32 + * @option --language=es6
    5.33 + * @option -scripting
    5.34 + */
    5.35 +
    5.36 +function tryIt(code) {
    5.37 +    try {
    5.38 +        eval(code)
    5.39 +    } catch (e) {
    5.40 +        print(e)
    5.41 +    }
    5.42 +}
    5.43 +
    5.44 +
    5.45 +tryIt(<<CODE
    5.46 +    function a () {
    5.47 +        this.val = 41
    5.48 +        let self = this
    5.49 +        this.b = function () {
    5.50 +            return self.val;
    5.51 +        }
    5.52 +    }
    5.53 +    c = new a()
    5.54 +    print(c.b.call(null))
    5.55 +CODE)
    5.56 +
    5.57 +
    5.58 +tryIt(<<CODE
    5.59 +        function a () {
    5.60 +            this.val = 42
    5.61 +            let self = this
    5.62 +            this.b = function () {
    5.63 +                return this.val;
    5.64 +            }.bind(self)
    5.65 +        }
    5.66 +        c = new a()
    5.67 +        print(c.b.call(null))
    5.68 +CODE)
    5.69 +
    5.70 +tryIt(<<CODE
    5.71 +    function a () {
    5.72 +        this.val = 43
    5.73 +        const self = this
    5.74 +        this.b = function () {
    5.75 +            return self.val;
    5.76 +        }
    5.77 +    }
    5.78 +    c = new a()
    5.79 +    print(c.b.call(null))
    5.80 +CODE)
    5.81 +
    5.82 +tryIt(<<CODE
    5.83 +        function a () {
    5.84 +            this.val = 44
    5.85 +            const self = this
    5.86 +            this.b = function () {
    5.87 +                return this.val;
    5.88 +            }.bind(self)
    5.89 +        }
    5.90 +        c = new a()
    5.91 +        print(c.b.call(null))
    5.92 +CODE)
    5.93 +
    5.94 +tryIt(<<CODE
    5.95 +       let a = {name : 'test'}
    5.96 +       let f = function () {
    5.97 +            print(this.name)
    5.98 +       }
    5.99 +       let nf = f.bind(a)
   5.100 +       nf()
   5.101 +       if (true) {
   5.102 +            let a = null
   5.103 +            nf()
   5.104 +       }
   5.105 +       nf()
   5.106 +CODE)
   5.107 +
   5.108 +
   5.109 +tryIt(<<CODE
   5.110 +       let arr = []
   5.111 +       for (let i = 0; i < 3; i++) {
   5.112 +           arr[i] = function(){return i;}
   5.113 +       }
   5.114 +       for (let i in arr) {
   5.115 +            print(arr[i]())
   5.116 +       }
   5.117 +       arr = []
   5.118 +       for (var i = 0; i < 3; i++) {
   5.119 +            (function(i){
   5.120 +                arr[i] = function(){return i;}
   5.121 +            })(i)
   5.122 +       }
   5.123 +       for (let i in arr) {
   5.124 +           print(arr[i]())
   5.125 +       }
   5.126 +CODE)
   5.127 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/script/basic/es6/let_const_closure.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
     6.3 @@ -0,0 +1,13 @@
     6.4 +41
     6.5 +42
     6.6 +43
     6.7 +44
     6.8 +test
     6.9 +test
    6.10 +test
    6.11 +3
    6.12 +3
    6.13 +3
    6.14 +0
    6.15 +1
    6.16 +2
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/script/basic/es6/let_const_reuse.js	Mon Sep 08 15:37:50 2014 +0400
     7.3 @@ -0,0 +1,71 @@
     7.4 +/*
     7.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/**
    7.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
    7.29 + *
    7.30 + * @test
    7.31 + * @run
    7.32 + * @option --language=es6
    7.33 + * @option -scripting
    7.34 + */
    7.35 +
    7.36 +function tryIt (code) {
    7.37 +     try {
    7.38 +         eval(code)
    7.39 +     } catch (e) {
    7.40 +         print(e)
    7.41 +     }
    7.42 +}
    7.43 +
    7.44 +tryIt(<<CODE
    7.45 +    let a = 23
    7.46 +    if (true) {
    7.47 +        a--
    7.48 +        let a = 43;
    7.49 +    }
    7.50 +CODE)
    7.51 +
    7.52 +tryIt(<<CODE
    7.53 +    const a = 23
    7.54 +    if (true) {
    7.55 +        a--
    7.56 +        const a = 43;
    7.57 +    }
    7.58 +CODE)
    7.59 +
    7.60 +tryIt(<<CODE
    7.61 +    let a = 23
    7.62 +    if (true) {
    7.63 +        a--
    7.64 +        const a = 43;
    7.65 +    }
    7.66 +CODE)
    7.67 +
    7.68 +tryIt(<<CODE
    7.69 +    const a = 23
    7.70 +    if (true) {
    7.71 +        a--
    7.72 +        let a = 43;
    7.73 +    }
    7.74 +CODE)
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/script/basic/es6/let_const_reuse.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
     8.3 @@ -0,0 +1,8 @@
     8.4 +ReferenceError: "a" is not defined
     8.5 +SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a"
     8.6 +        a--
     8.7 +        ^
     8.8 +SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a"
     8.9 +        a--
    8.10 +        ^
    8.11 +ReferenceError: "a" is not defined
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/script/basic/es6/let_different_types.js	Mon Sep 08 15:37:50 2014 +0400
     9.3 @@ -0,0 +1,73 @@
     9.4 +/*
     9.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + * 
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.
    9.11 + * 
    9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 + * version 2 for more details (a copy is included in the LICENSE file that
    9.16 + * accompanied this code).
    9.17 + * 
    9.18 + * You should have received a copy of the GNU General Public License version
    9.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 + * 
    9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.23 + * or visit www.oracle.com if you need additional information or have any
    9.24 + * questions.
    9.25 + */
    9.26 +
    9.27 +/**
    9.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
    9.29 + *
    9.30 + * @test
    9.31 + * @run
    9.32 + * @option --language=es6
    9.33 + * @option -scripting
    9.34 + */
    9.35 +
    9.36 +function tryIt (code) {
    9.37 +    try {
    9.38 +        eval(code)
    9.39 +    } catch (e) {
    9.40 +        print(e)
    9.41 +    }
    9.42 +}
    9.43 +
    9.44 +tryIt(<<CODE
    9.45 +    let a = function () {  var a = "Hello World!"; return a; }
    9.46 +    print(typeof a)
    9.47 +    {
    9.48 +        let a = 34;
    9.49 +        print(typeof a)
    9.50 +        if (true) {
    9.51 +            let c = 54.7
    9.52 +            var d = c
    9.53 +            print(typeof c)
    9.54 +            print(typeof d)
    9.55 +        }
    9.56 +    }
    9.57 +    print(typeof a)
    9.58 +    print(typeof a())
    9.59 +    print(typeof c)
    9.60 +    print(typeof d)
    9.61 +    print(d)
    9.62 +CODE)
    9.63 +
    9.64 +tryIt(<<CODE
    9.65 +    let a = {}
    9.66 +    if (true) {
    9.67 +        function a () {
    9.68 +            print (typeof a)
    9.69 +            return 'Hello World!'
    9.70 +        }
    9.71 +        print(typeof a)
    9.72 +        print(a())
    9.73 +    }
    9.74 +    print(typeof a)
    9.75 +CODE)
    9.76 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/script/basic/es6/let_different_types.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
    10.3 @@ -0,0 +1,13 @@
    10.4 +function
    10.5 +number
    10.6 +number
    10.7 +number
    10.8 +function
    10.9 +string
   10.10 +undefined
   10.11 +number
   10.12 +54.7
   10.13 +function
   10.14 +function
   10.15 +Hello World!
   10.16 +object
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/script/basic/es6/let_loops.js	Mon Sep 08 15:37:50 2014 +0400
    11.3 @@ -0,0 +1,80 @@
    11.4 +/*
    11.5 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.
   11.11 + *
   11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 + * version 2 for more details (a copy is included in the LICENSE file that
   11.16 + * accompanied this code).
   11.17 + *
   11.18 + * You should have received a copy of the GNU General Public License version
   11.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 + *
   11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.23 + * or visit www.oracle.com if you need additional information or have any
   11.24 + * questions.
   11.25 + */
   11.26 +
   11.27 +/**
   11.28 + * JDK-8057678: Tests for let&const keywords in Nashorn
   11.29 + *
   11.30 + * @test
   11.31 + * @run
   11.32 + * @option --language=es6
   11.33 + * @option -scripting
   11.34 + */
   11.35 +
   11.36 +
   11.37 +function tryIt (code) {
   11.38 +    try {
   11.39 +        eval(code)
   11.40 +    } catch (e) {
   11.41 +        print(e)
   11.42 +    }
   11.43 +}
   11.44 +
   11.45 +tryIt(<<CODE
   11.46 +      let a = 2;
   11.47 +      do {
   11.48 +        a--;
   11.49 +        let b = a;
   11.50 +      } while (a > 0);
   11.51 +      print(a)
   11.52 +      print(b)
   11.53 +CODE)
   11.54 +
   11.55 +tryIt(<<CODE
   11.56 +       let a = 2
   11.57 +       while(a > 0) {
   11.58 +            a--
   11.59 +            let b = a
   11.60 +       }
   11.61 +       print(a)
   11.62 +       print(b)
   11.63 +CODE)
   11.64 +
   11.65 +tryIt(<<CODE
   11.66 +       let a = 2
   11.67 +       while(a > 0) {
   11.68 +            a--
   11.69 +            const b = a
   11.70 +       }
   11.71 +       print(a)
   11.72 +       print(b)
   11.73 +CODE)
   11.74 +
   11.75 +tryIt(<<CODE
   11.76 +       let a = 2;
   11.77 +       do {
   11.78 +         a--;
   11.79 +         const b = a;
   11.80 +       } while (a > 0);
   11.81 +       print(a)
   11.82 +       print(b)
   11.83 +CODE)
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/script/basic/es6/let_loops.js.EXPECTED	Mon Sep 08 15:37:50 2014 +0400
    12.3 @@ -0,0 +1,8 @@
    12.4 +0
    12.5 +ReferenceError: "b" is not defined
    12.6 +0
    12.7 +ReferenceError: "b" is not defined
    12.8 +0
    12.9 +ReferenceError: "b" is not defined
   12.10 +0
   12.11 +ReferenceError: "b" is not defined

mercurial