| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 { SimpleContext context; | 779 { SimpleContext context; |
| 780 context.Check("var x = 1; x", | 780 context.Check("var x = 1; x", |
| 781 EXPECT_RESULT, Number::New(1)); | 781 EXPECT_RESULT, Number::New(1)); |
| 782 context.Check("x", | 782 context.Check("x", |
| 783 EXPECT_RESULT, Number::New(1)); | 783 EXPECT_RESULT, Number::New(1)); |
| 784 context.Check("this.x", | 784 context.Check("this.x", |
| 785 EXPECT_RESULT, Number::New(1)); | 785 EXPECT_RESULT, Number::New(1)); |
| 786 } | 786 } |
| 787 | 787 |
| 788 { SimpleContext context; | 788 { SimpleContext context; |
| 789 context.Check("function x() { return 4 }; x()", |
| 790 EXPECT_RESULT, Number::New(4)); |
| 791 context.Check("x()", |
| 792 EXPECT_RESULT, Number::New(4)); |
| 793 context.Check("this.x()", |
| 794 EXPECT_RESULT, Number::New(4)); |
| 795 } |
| 796 |
| 797 { SimpleContext context; |
| 789 context.Check("let x = 2; x", | 798 context.Check("let x = 2; x", |
| 790 EXPECT_RESULT, Number::New(2)); | 799 EXPECT_RESULT, Number::New(2)); |
| 791 context.Check("x", | 800 context.Check("x", |
| 792 EXPECT_RESULT, Number::New(2)); | 801 EXPECT_RESULT, Number::New(2)); |
| 793 context.Check("this.x", | 802 // TODO(rossberg): The current ES6 draft spec does not reflect lexical |
| 794 EXPECT_RESULT, Number::New(2)); | 803 // bindings on the global object. However, this will probably change, in |
| 804 // which case we reactivate the following test. |
| 805 // context.Check("this.x", |
| 806 // EXPECT_RESULT, Number::New(2)); |
| 795 } | 807 } |
| 796 | 808 |
| 797 { SimpleContext context; | 809 { SimpleContext context; |
| 798 context.Check("const x = 3; x", | 810 context.Check("const x = 3; x", |
| 799 EXPECT_RESULT, Number::New(3)); | 811 EXPECT_RESULT, Number::New(3)); |
| 800 context.Check("x", | 812 context.Check("x", |
| 801 EXPECT_RESULT, Number::New(3)); | 813 EXPECT_RESULT, Number::New(3)); |
| 802 context.Check("this.x", | 814 // TODO(rossberg): The current ES6 draft spec does not reflect lexical |
| 803 EXPECT_RESULT, Number::New(3)); | 815 // bindings on the global object. However, this will probably change, in |
| 804 } | 816 // which case we reactivate the following test. |
| 805 | 817 // context.Check("this.x", |
| 806 { SimpleContext context; | 818 // EXPECT_RESULT, Number::New(3)); |
| 807 context.Check("function x() { return 4 }; x()", | |
| 808 EXPECT_RESULT, Number::New(4)); | |
| 809 context.Check("x()", | |
| 810 EXPECT_RESULT, Number::New(4)); | |
| 811 context.Check("this.x()", | |
| 812 EXPECT_RESULT, Number::New(4)); | |
| 813 } | 819 } |
| 814 | 820 |
| 815 // TODO(rossberg): All of the below should actually be errors in Harmony. | 821 // TODO(rossberg): All of the below should actually be errors in Harmony. |
| 816 | 822 |
| 817 { SimpleContext context; | 823 { SimpleContext context; |
| 818 context.Check("var x = 1; x", | 824 context.Check("var x = 1; x", |
| 819 EXPECT_RESULT, Number::New(1)); | 825 EXPECT_RESULT, Number::New(1)); |
| 820 context.Check("let x = 2; x", | 826 context.Check("let x = 2; x", |
| 821 EXPECT_RESULT, Number::New(2)); | 827 EXPECT_RESULT, Number::New(2)); |
| 822 } | 828 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 839 context.Check("function x() { return 1 }; x()", | 845 context.Check("function x() { return 1 }; x()", |
| 840 EXPECT_RESULT, Number::New(1)); | 846 EXPECT_RESULT, Number::New(1)); |
| 841 context.Check("const x = 2; x", | 847 context.Check("const x = 2; x", |
| 842 EXPECT_RESULT, Number::New(2)); | 848 EXPECT_RESULT, Number::New(2)); |
| 843 } | 849 } |
| 844 | 850 |
| 845 { SimpleContext context; | 851 { SimpleContext context; |
| 846 context.Check("let x = 1; x", | 852 context.Check("let x = 1; x", |
| 847 EXPECT_RESULT, Number::New(1)); | 853 EXPECT_RESULT, Number::New(1)); |
| 848 context.Check("var x = 2; x", | 854 context.Check("var x = 2; x", |
| 849 EXPECT_RESULT, Number::New(2)); | 855 EXPECT_ERROR); |
| 850 } | 856 } |
| 851 | 857 |
| 852 { SimpleContext context; | 858 { SimpleContext context; |
| 853 context.Check("let x = 1; x", | 859 context.Check("let x = 1; x", |
| 854 EXPECT_RESULT, Number::New(1)); | 860 EXPECT_RESULT, Number::New(1)); |
| 855 context.Check("let x = 2; x", | 861 context.Check("let x = 2; x", |
| 856 EXPECT_RESULT, Number::New(2)); | 862 EXPECT_ERROR); |
| 857 } | 863 } |
| 858 | 864 |
| 859 { SimpleContext context; | 865 { SimpleContext context; |
| 860 context.Check("let x = 1; x", | 866 context.Check("let x = 1; x", |
| 861 EXPECT_RESULT, Number::New(1)); | 867 EXPECT_RESULT, Number::New(1)); |
| 862 context.Check("const x = 2; x", | 868 context.Check("const x = 2; x", |
| 863 EXPECT_RESULT, Number::New(2)); | 869 EXPECT_ERROR); |
| 864 } | 870 } |
| 865 | 871 |
| 866 { SimpleContext context; | 872 { SimpleContext context; |
| 867 context.Check("let x = 1; x", | 873 context.Check("let x = 1; x", |
| 868 EXPECT_RESULT, Number::New(1)); | 874 EXPECT_RESULT, Number::New(1)); |
| 869 context.Check("function x() { return 2 }; x()", | 875 context.Check("function x() { return 2 }; x()", |
| 870 EXPECT_RESULT, Number::New(2)); | 876 EXPECT_ERROR); |
| 871 } | 877 } |
| 872 | 878 |
| 873 { SimpleContext context; | 879 { SimpleContext context; |
| 874 context.Check("const x = 1; x", | 880 context.Check("const x = 1; x", |
| 875 EXPECT_RESULT, Number::New(1)); | 881 EXPECT_RESULT, Number::New(1)); |
| 876 context.Check("var x = 2; x", | 882 context.Check("var x = 2; x", |
| 877 EXPECT_RESULT, Number::New(1)); | 883 EXPECT_ERROR); |
| 878 } | 884 } |
| 879 | 885 |
| 880 { SimpleContext context; | 886 { SimpleContext context; |
| 881 context.Check("const x = 1; x", | 887 context.Check("const x = 1; x", |
| 882 EXPECT_RESULT, Number::New(1)); | 888 EXPECT_RESULT, Number::New(1)); |
| 883 context.Check("let x = 2; x", | 889 context.Check("let x = 2; x", |
| 884 EXPECT_EXCEPTION); | 890 EXPECT_ERROR); |
| 885 } | 891 } |
| 886 | 892 |
| 887 { SimpleContext context; | 893 { SimpleContext context; |
| 888 context.Check("const x = 1; x", | 894 context.Check("const x = 1; x", |
| 889 EXPECT_RESULT, Number::New(1)); | 895 EXPECT_RESULT, Number::New(1)); |
| 890 context.Check("const x = 2; x", | 896 context.Check("const x = 2; x", |
| 891 EXPECT_RESULT, Number::New(1)); | 897 EXPECT_ERROR); |
| 892 } | 898 } |
| 893 | 899 |
| 894 { SimpleContext context; | 900 { SimpleContext context; |
| 895 context.Check("const x = 1; x", | 901 context.Check("const x = 1; x", |
| 896 EXPECT_RESULT, Number::New(1)); | 902 EXPECT_RESULT, Number::New(1)); |
| 897 context.Check("function x() { return 2 }; x()", | 903 context.Check("function x() { return 2 }; x()", |
| 898 EXPECT_EXCEPTION); | 904 EXPECT_ERROR); |
| 899 } | 905 } |
| 900 } | 906 } |
| OLD | NEW |