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 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 { NULL, NULL } | 1824 { NULL, NULL } |
1825 }; | 1825 }; |
1826 | 1826 |
1827 const char* statement_data[] = { | 1827 const char* statement_data[] = { |
1828 "(\"use strict\"); var eval;", | 1828 "(\"use strict\"); var eval;", |
1829 NULL | 1829 NULL |
1830 }; | 1830 }; |
1831 | 1831 |
1832 RunParserSyncTest(context_data, statement_data, kSuccess); | 1832 RunParserSyncTest(context_data, statement_data, kSuccess); |
1833 } | 1833 } |
| 1834 |
| 1835 |
| 1836 TEST(ErrorsNotAnIdentifierName) { |
| 1837 const char* context_data[][2] = { |
| 1838 { "", ""}, |
| 1839 { "\"use strict\";", ""}, |
| 1840 { NULL, NULL } |
| 1841 }; |
| 1842 |
| 1843 const char* statement_data[] = { |
| 1844 "var foo = {}; foo.{;", |
| 1845 "var foo = {}; foo.};", |
| 1846 "var foo = {}; foo.=;", |
| 1847 "var foo = {}; foo.888;", |
| 1848 "var foo = {}; foo.-;", |
| 1849 "var foo = {}; foo.--;", |
| 1850 NULL |
| 1851 }; |
| 1852 |
| 1853 RunParserSyncTest(context_data, statement_data, kError); |
| 1854 } |
| 1855 |
| 1856 |
| 1857 TEST(NoErrorsIdentifierNames) { |
| 1858 // Keywords etc. are valid as property names. |
| 1859 const char* context_data[][2] = { |
| 1860 { "", ""}, |
| 1861 { "\"use strict\";", ""}, |
| 1862 { NULL, NULL } |
| 1863 }; |
| 1864 |
| 1865 const char* statement_data[] = { |
| 1866 "var foo = {}; foo.if;", |
| 1867 "var foo = {}; foo.yield;", |
| 1868 "var foo = {}; foo.super;", |
| 1869 "var foo = {}; foo.interface;", |
| 1870 "var foo = {}; foo.eval;", |
| 1871 "var foo = {}; foo.arguments;", |
| 1872 NULL |
| 1873 }; |
| 1874 |
| 1875 RunParserSyncTest(context_data, statement_data, kSuccess); |
| 1876 } |
OLD | NEW |