OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6768 | 6768 |
6769 TEST(LegacyConst) { | 6769 TEST(LegacyConst) { |
6770 // clang-format off | 6770 // clang-format off |
6771 const char* context_data[][2] = { | 6771 const char* context_data[][2] = { |
6772 {"", ""}, | 6772 {"", ""}, |
6773 {"{", "}"}, | 6773 {"{", "}"}, |
6774 {NULL, NULL} | 6774 {NULL, NULL} |
6775 }; | 6775 }; |
6776 | 6776 |
6777 const char* data[] = { | 6777 const char* data[] = { |
6778 "const x", | |
6779 "const x = 1", | 6778 "const x = 1", |
6780 "for (const x = 1; x < 1; x++) {}", | 6779 "for (const x = 1; x < 1; x++) {}", |
6781 "for (const x in {}) {}", | 6780 "for (const x in {}) {}", |
6782 "for (const x of []) {}", | 6781 "for (const x of []) {}", |
6783 NULL | 6782 NULL |
6784 }; | 6783 }; |
6785 // clang-format on | 6784 // clang-format on |
6786 | 6785 |
6787 static const ParserFlag always_flags[] = {kNoLegacyConst}; | 6786 { |
6787 static const ParserFlag always_flags[] = {kNoLegacyConst}; | |
rossberg
2015/07/08 11:49:56
It seems a bit weird to run the LegacyConst test w
arv (Not doing code reviews)
2015/07/08 13:43:45
Agreed and done.
| |
6788 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | |
6789 arraysize(always_flags)); | |
6790 } | |
6788 | 6791 |
6789 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 6792 RunParserSyncTest(context_data, data, kSuccess); |
6793 | |
6794 { | |
6795 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, | |
6796 kNoLegacyConst}; | |
6797 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | |
6798 arraysize(always_flags)); | |
6799 } | |
6800 } | |
6801 | |
6802 | |
6803 TEST(LetSloppy) { | |
6804 // clang-format off | |
6805 const char* context_data[][2] = { | |
6806 {"", ""}, | |
6807 {"'use strict';", ""}, | |
6808 {"{", "}"}, | |
6809 {NULL, NULL} | |
6810 }; | |
6811 | |
6812 const char* data[] = { | |
6813 "let x", | |
6814 "let x = 1", | |
6815 "for (let x = 1; x < 1; x++) {}", | |
6816 "for (let x in {}) {}", | |
6817 "for (let x of []) {}", | |
6818 NULL | |
6819 }; | |
6820 // clang-format on | |
6821 | |
6822 static const ParserFlag always_flags[] = {kAllowHarmonySloppy}; | |
6823 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | |
6790 arraysize(always_flags)); | 6824 arraysize(always_flags)); |
6791 RunParserSyncTest(context_data, data, kSuccess); | |
6792 } | 6825 } |
OLD | NEW |