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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 CHECK_EQ(i::Token::MUL, bin->op()); | 1144 CHECK_EQ(i::Token::MUL, bin->op()); |
1145 i::Literal* rlit = bin->right()->AsLiteral(); | 1145 i::Literal* rlit = bin->right()->AsLiteral(); |
1146 const i::AstValue* val = rlit->raw_value(); | 1146 const i::AstValue* val = rlit->raw_value(); |
1147 CHECK(with_dot == val->ContainsDot()); | 1147 CHECK(with_dot == val->ContainsDot()); |
1148 CHECK_EQ(1.0, val->AsNumber()); | 1148 CHECK_EQ(1.0, val->AsNumber()); |
1149 } | 1149 } |
1150 } | 1150 } |
1151 | 1151 |
1152 | 1152 |
1153 TEST(ParseNumbers) { | 1153 TEST(ParseNumbers) { |
| 1154 CheckParsesToNumber("1.", true); |
1154 CheckParsesToNumber("1.34", true); | 1155 CheckParsesToNumber("1.34", true); |
1155 CheckParsesToNumber("134", false); | 1156 CheckParsesToNumber("134", false); |
1156 CheckParsesToNumber("134e44", false); | 1157 CheckParsesToNumber("134e44", false); |
1157 CheckParsesToNumber("134.e44", true); | 1158 CheckParsesToNumber("134.e44", true); |
1158 CheckParsesToNumber("134.44e44", true); | 1159 CheckParsesToNumber("134.44e44", true); |
1159 CheckParsesToNumber(".44", true); | 1160 CheckParsesToNumber(".44", true); |
| 1161 |
| 1162 CheckParsesToNumber("-1.", true); |
| 1163 CheckParsesToNumber("-1.0", true); |
| 1164 CheckParsesToNumber("-1.34", true); |
| 1165 CheckParsesToNumber("-134", false); |
| 1166 CheckParsesToNumber("-134e44", false); |
| 1167 CheckParsesToNumber("-134.e44", true); |
| 1168 CheckParsesToNumber("-134.44e44", true); |
| 1169 CheckParsesToNumber("-.44", true); |
| 1170 |
1160 CheckParsesToNumber("+x", true); | 1171 CheckParsesToNumber("+x", true); |
1161 } | 1172 } |
1162 | 1173 |
1163 | 1174 |
1164 TEST(ScopePositions) { | 1175 TEST(ScopePositions) { |
1165 // Test the parser for correctly setting the start and end positions | 1176 // Test the parser for correctly setting the start and end positions |
1166 // of a scope. We check the scope positions of exactly one scope | 1177 // of a scope. We check the scope positions of exactly one scope |
1167 // nested in the global scope of a program. 'inner source' is the | 1178 // nested in the global scope of a program. 'inner source' is the |
1168 // source code that determines the part of the source belonging | 1179 // source code that determines the part of the source belonging |
1169 // to the nested scope. 'outer_prefix' and 'outer_suffix' are | 1180 // to the nested scope. 'outer_prefix' and 'outer_suffix' are |
(...skipping 6313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7483 "var publ\\u0069c = 1;", | 7494 "var publ\\u0069c = 1;", |
7484 "var { publ\\u0069c } = {};", | 7495 "var { publ\\u0069c } = {};", |
7485 NULL}; | 7496 NULL}; |
7486 RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0, | 7497 RunParserSyncTest(sloppy_context_data, valid_data, kSuccess, NULL, 0, |
7487 always_flags, arraysize(always_flags)); | 7498 always_flags, arraysize(always_flags)); |
7488 RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, | 7499 RunParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, |
7489 always_flags, arraysize(always_flags)); | 7500 always_flags, arraysize(always_flags)); |
7490 RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, | 7501 RunModuleParserSyncTest(strict_context_data, valid_data, kError, NULL, 0, |
7491 always_flags, arraysize(always_flags)); | 7502 always_flags, arraysize(always_flags)); |
7492 } | 7503 } |
OLD | NEW |