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 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 "/foo/", | 2714 "/foo/", |
2715 "/foo/g", | 2715 "/foo/g", |
2716 "/foo/whatever", // This is an error but not detected by the parser. | 2716 "/foo/whatever", // This is an error but not detected by the parser. |
2717 NULL | 2717 NULL |
2718 }; | 2718 }; |
2719 | 2719 |
2720 RunParserSyncTest(context_data, statement_data, kSuccess); | 2720 RunParserSyncTest(context_data, statement_data, kSuccess); |
2721 } | 2721 } |
2722 | 2722 |
2723 | 2723 |
2724 TEST(Intrinsics) { | |
2725 const char* context_data[][2] = { | |
2726 {"", ""}, | |
2727 { NULL, NULL } | |
2728 }; | |
2729 | |
2730 const char* statement_data[] = { | |
2731 "%someintrinsic(arg)", | |
2732 NULL | |
2733 }; | |
2734 | |
2735 // This test requires kAllowNatives to succeed. | |
2736 static const ParserFlag always_true_flags[] = { | |
2737 kAllowNatives | |
2738 }; | |
2739 | |
2740 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, | |
2741 always_true_flags, 1); | |
2742 } | |
2743 | |
2744 | |
2745 TEST(NoErrorsNewExpression) { | 2724 TEST(NoErrorsNewExpression) { |
2746 const char* context_data[][2] = { | 2725 const char* context_data[][2] = { |
2747 {"", ""}, | 2726 {"", ""}, |
2748 {"var f =", ""}, | 2727 {"var f =", ""}, |
2749 { NULL, NULL } | 2728 { NULL, NULL } |
2750 }; | 2729 }; |
2751 | 2730 |
2752 const char* statement_data[] = { | 2731 const char* statement_data[] = { |
2753 "new foo", | 2732 "new foo", |
2754 "new foo();", | 2733 "new foo();", |
(...skipping 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6895 "for (let x of []) {}", | 6874 "for (let x of []) {}", |
6896 NULL | 6875 NULL |
6897 }; | 6876 }; |
6898 // clang-format on | 6877 // clang-format on |
6899 | 6878 |
6900 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, | 6879 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
6901 kAllowHarmonySloppyLet}; | 6880 kAllowHarmonySloppyLet}; |
6902 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 6881 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
6903 arraysize(always_flags)); | 6882 arraysize(always_flags)); |
6904 } | 6883 } |
OLD | NEW |