OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); | 515 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); |
516 } | 516 } |
517 | 517 |
518 | 518 |
519 TEST(RegExpLiteral) { | 519 TEST(RegExpLiteral) { |
520 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); | 520 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); |
521 | 521 |
522 T.CheckTrue(T.Val("abc")); | 522 T.CheckTrue(T.Val("abc")); |
523 T.CheckFalse(T.Val("xyz")); | 523 T.CheckFalse(T.Val("xyz")); |
524 } | 524 } |
| 525 |
| 526 |
| 527 TEST(ClassLiteral) { |
| 528 FLAG_harmony_classes = true; |
| 529 FLAG_harmony_sloppy = true; |
| 530 FLAG_harmony_object_literals = true; |
| 531 const char* src = |
| 532 "(function(a,b) {" |
| 533 " class C {" |
| 534 " x() { return a; }" |
| 535 " static y() { return b; }" |
| 536 " get z() { return 0; }" |
| 537 " }" |
| 538 " return new C().x() + C.y();" |
| 539 "})"; |
| 540 FunctionTester T(src); |
| 541 |
| 542 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); |
| 543 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); |
| 544 } |
OLD | NEW |