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 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 "/foo/", | 2711 "/foo/", |
2712 "/foo/g", | 2712 "/foo/g", |
2713 "/foo/whatever", // This is an error but not detected by the parser. | 2713 "/foo/whatever", // This is an error but not detected by the parser. |
2714 NULL | 2714 NULL |
2715 }; | 2715 }; |
2716 | 2716 |
2717 RunParserSyncTest(context_data, statement_data, kSuccess); | 2717 RunParserSyncTest(context_data, statement_data, kSuccess); |
2718 } | 2718 } |
2719 | 2719 |
2720 | 2720 |
2721 TEST(Intrinsics) { | |
2722 const char* context_data[][2] = { | |
2723 {"", ""}, | |
2724 { NULL, NULL } | |
2725 }; | |
2726 | |
2727 const char* statement_data[] = { | |
2728 "%someintrinsic(arg)", | |
2729 NULL | |
2730 }; | |
2731 | |
2732 // This test requires kAllowNatives to succeed. | |
2733 static const ParserFlag always_true_flags[] = { | |
2734 kAllowNatives | |
2735 }; | |
2736 | |
2737 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0, | |
2738 always_true_flags, 1); | |
2739 } | |
2740 | |
2741 | |
2742 TEST(NoErrorsNewExpression) { | 2721 TEST(NoErrorsNewExpression) { |
2743 const char* context_data[][2] = { | 2722 const char* context_data[][2] = { |
2744 {"", ""}, | 2723 {"", ""}, |
2745 {"var f =", ""}, | 2724 {"var f =", ""}, |
2746 { NULL, NULL } | 2725 { NULL, NULL } |
2747 }; | 2726 }; |
2748 | 2727 |
2749 const char* statement_data[] = { | 2728 const char* statement_data[] = { |
2750 "new foo", | 2729 "new foo", |
2751 "new foo();", | 2730 "new foo();", |
(...skipping 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6872 "for (let x of []) {}", | 6851 "for (let x of []) {}", |
6873 NULL | 6852 NULL |
6874 }; | 6853 }; |
6875 // clang-format on | 6854 // clang-format on |
6876 | 6855 |
6877 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, | 6856 static const ParserFlag always_flags[] = {kAllowHarmonySloppy, |
6878 kAllowHarmonySloppyLet}; | 6857 kAllowHarmonySloppyLet}; |
6879 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, | 6858 RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
6880 arraysize(always_flags)); | 6859 arraysize(always_flags)); |
6881 } | 6860 } |
OLD | NEW |