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 "test/cctest/compiler/function-tester.h" | 5 #include "test/cctest/compiler/function-tester.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace compiler { | 9 namespace compiler { |
10 | 10 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 TEST(RegExpLiteral) { | 506 TEST(RegExpLiteral) { |
507 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); | 507 FunctionTester T("(function(a) { o = /b/; return o.test(a); })"); |
508 | 508 |
509 T.CheckTrue(T.Val("abc")); | 509 T.CheckTrue(T.Val("abc")); |
510 T.CheckFalse(T.Val("xyz")); | 510 T.CheckFalse(T.Val("xyz")); |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 TEST(ClassLiteral) { | 514 TEST(ClassLiteral) { |
515 FLAG_harmony_sloppy = true; | |
516 const char* src = | 515 const char* src = |
517 "(function(a,b) {" | 516 "(function(a,b) {" |
518 " class C {" | 517 " class C {" |
519 " x() { return a; }" | 518 " x() { return a; }" |
520 " static y() { return b; }" | 519 " static y() { return b; }" |
521 " get z() { return 0; }" | 520 " get z() { return 0; }" |
522 " constructor() {}" | 521 " constructor() {}" |
523 " }" | 522 " }" |
524 " return new C().x() + C.y();" | 523 " return new C().x() + C.y();" |
525 "})"; | 524 "})"; |
526 FunctionTester T(src); | 525 FunctionTester T(src); |
527 | 526 |
528 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); | 527 T.CheckCall(T.Val(65), T.Val(23), T.Val(42)); |
529 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); | 528 T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b")); |
530 } | 529 } |
531 | 530 |
532 } // namespace compiler | 531 } // namespace compiler |
533 } // namespace internal | 532 } // namespace internal |
534 } // namespace v8 | 533 } // namespace v8 |
OLD | NEW |