OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return; | 152 return; |
153 } | 153 } |
154 CHECK(!script.IsEmpty()); | 154 CHECK(!script.IsEmpty()); |
155 Local<Value> result = script->Run(); | 155 Local<Value> result = script->Run(); |
156 CHECK_EQ(get, get_count()); | 156 CHECK_EQ(get, get_count()); |
157 CHECK_EQ(set, set_count()); | 157 CHECK_EQ(set, set_count()); |
158 CHECK_EQ(query, query_count()); | 158 CHECK_EQ(query, query_count()); |
159 if (expectations == EXPECT_RESULT) { | 159 if (expectations == EXPECT_RESULT) { |
160 CHECK(!catcher.HasCaught()); | 160 CHECK(!catcher.HasCaught()); |
161 if (!value.IsEmpty()) { | 161 if (!value.IsEmpty()) { |
162 CHECK_EQ(value, result); | 162 CHECK(value->Equals(result)); |
163 } | 163 } |
164 } else { | 164 } else { |
165 CHECK(expectations == EXPECT_EXCEPTION); | 165 CHECK(expectations == EXPECT_EXCEPTION); |
166 CHECK(catcher.HasCaught()); | 166 CHECK(catcher.HasCaught()); |
167 if (!value.IsEmpty()) { | 167 if (!value.IsEmpty()) { |
168 CHECK_EQ(value, catcher.Exception()); | 168 CHECK(value->Equals(catcher.Exception())); |
169 } | 169 } |
170 } | 170 } |
171 // Clean slate for the next test. | 171 // Clean slate for the next test. |
172 CcTest::heap()->CollectAllAvailableGarbage(); | 172 CcTest::heap()->CollectAllAvailableGarbage(); |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 void DeclarationContext::HandleGet( | 176 void DeclarationContext::HandleGet( |
177 Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) { | 177 Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) { |
178 DeclarationContext* context = GetInstance(info.Data()); | 178 DeclarationContext* context = GetInstance(info.Data()); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source)); | 573 Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source)); |
574 if (expectations == EXPECT_ERROR) { | 574 if (expectations == EXPECT_ERROR) { |
575 CHECK(script.IsEmpty()); | 575 CHECK(script.IsEmpty()); |
576 return; | 576 return; |
577 } | 577 } |
578 CHECK(!script.IsEmpty()); | 578 CHECK(!script.IsEmpty()); |
579 Local<Value> result = script->Run(); | 579 Local<Value> result = script->Run(); |
580 if (expectations == EXPECT_RESULT) { | 580 if (expectations == EXPECT_RESULT) { |
581 CHECK(!catcher.HasCaught()); | 581 CHECK(!catcher.HasCaught()); |
582 if (!value.IsEmpty()) { | 582 if (!value.IsEmpty()) { |
583 CHECK_EQ(value, result); | 583 CHECK(value->Equals(result)); |
584 } | 584 } |
585 } else { | 585 } else { |
586 CHECK(expectations == EXPECT_EXCEPTION); | 586 CHECK(expectations == EXPECT_EXCEPTION); |
587 CHECK(catcher.HasCaught()); | 587 CHECK(catcher.HasCaught()); |
588 if (!value.IsEmpty()) { | 588 if (!value.IsEmpty()) { |
589 CHECK_EQ(value, catcher.Exception()); | 589 CHECK(value->Equals(catcher.Exception())); |
590 } | 590 } |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 private: | 594 private: |
595 HandleScope handle_scope_; | 595 HandleScope handle_scope_; |
596 Local<Context> context_; | 596 Local<Context> context_; |
597 }; | 597 }; |
598 | 598 |
599 | 599 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 context.Check("'use strict';const x = 1; x", EXPECT_RESULT, | 1138 context.Check("'use strict';const x = 1; x", EXPECT_RESULT, |
1139 Number::New(CcTest::isolate(), 1)); | 1139 Number::New(CcTest::isolate(), 1)); |
1140 context.Check("f();", EXPECT_EXCEPTION); | 1140 context.Check("f();", EXPECT_EXCEPTION); |
1141 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); | 1141 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); |
1142 context.Check("f();", EXPECT_EXCEPTION); | 1142 context.Check("f();", EXPECT_EXCEPTION); |
1143 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); | 1143 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); |
1144 context.Check("%OptimizeFunctionOnNextCall(f);f();", EXPECT_EXCEPTION); | 1144 context.Check("%OptimizeFunctionOnNextCall(f);f();", EXPECT_EXCEPTION); |
1145 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); | 1145 context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1)); |
1146 } | 1146 } |
1147 } | 1147 } |
OLD | NEW |