Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: test/cctest/test-decls.cc

Issue 10105026: Version 3.10.3 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 { ExistsInPrototypeContext context; 528 { ExistsInPrototypeContext context;
529 context.Check("this.x = 87; this.x", 529 context.Check("this.x = 87; this.x",
530 0, 530 0,
531 0, 531 0,
532 0, 532 0,
533 EXPECT_RESULT, Number::New(87)); 533 EXPECT_RESULT, Number::New(87));
534 } 534 }
535 535
536 { ExistsInPrototypeContext context; 536 { ExistsInPrototypeContext context;
537 context.Check("var x; x", 537 context.Check("var x; x",
538 1, // get 538 0, // get
539 0, 539 0,
540 1, // declaration 540 0, // declaration
541 EXPECT_EXCEPTION); 541 EXPECT_RESULT, Undefined());
542 } 542 }
543 543
544 { ExistsInPrototypeContext context; 544 { ExistsInPrototypeContext context;
545 context.Check("var x = 0; x", 545 context.Check("var x = 0; x",
546 0, 546 0,
547 0, 547 0,
548 1, // declaration 548 0, // declaration
549 EXPECT_RESULT, Number::New(0)); 549 EXPECT_RESULT, Number::New(0));
550 } 550 }
551 551
552 { ExistsInPrototypeContext context; 552 { ExistsInPrototypeContext context;
553 context.Check("const x; x", 553 context.Check("const x; x",
554 0, 554 0,
555 0, 555 0,
556 1, // declaration 556 0, // declaration
557 EXPECT_RESULT, Undefined()); 557 EXPECT_RESULT, Undefined());
558 } 558 }
559 559
560 { ExistsInPrototypeContext context; 560 { ExistsInPrototypeContext context;
561 context.Check("const x = 0; x", 561 context.Check("const x = 0; x",
562 0, 562 0,
563 0, 563 0,
564 1, // declaration 564 0, // declaration
565 EXPECT_RESULT, Number::New(0)); 565 EXPECT_RESULT, Number::New(0));
566 } 566 }
567 } 567 }
568 568
569 569
570 570
571 class AbsentInPrototypeContext: public DeclarationContext { 571 class AbsentInPrototypeContext: public DeclarationContext {
572 protected: 572 protected:
573 virtual v8::Handle<Integer> Query(Local<String> key) { 573 virtual v8::Handle<Integer> Query(Local<String> key) {
574 // Let it seem that the property is absent in the prototype object. 574 // Let it seem that the property is absent in the prototype object.
575 return Handle<Integer>(); 575 return Handle<Integer>();
576 } 576 }
577 577
578 // Use the prototype as the holder for the interceptors. 578 // Use the prototype as the holder for the interceptors.
579 virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { 579 virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) {
580 return function->PrototypeTemplate(); 580 return function->PrototypeTemplate();
581 } 581 }
582 }; 582 };
583 583
584 584
585 TEST(AbsentInPrototype) { 585 TEST(AbsentInPrototype) {
586 HandleScope scope; 586 HandleScope scope;
587 587
588 { AbsentInPrototypeContext context; 588 { AbsentInPrototypeContext context;
589 context.Check("if (false) { var x = 0; }; x", 589 context.Check("if (false) { var x = 0; }; x",
590 0, 590 0,
591 0, 591 0,
592 1, // declaration 592 0, // declaration
593 EXPECT_RESULT, Undefined()); 593 EXPECT_RESULT, Undefined());
594 } 594 }
595 } 595 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698