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

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

Issue 22932004: Adding missing operator!= for Handle and Persistent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: renamed test Created 7 years, 4 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 | « include/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 #else 3181 #else
3182 v8::Persistent<Value>& global_value = 3182 v8::Persistent<Value>& global_value =
3183 v8::Persistent<Value>::Cast(global_string); 3183 v8::Persistent<Value>::Cast(global_string);
3184 #endif 3184 #endif
3185 CHECK(v8::Local<v8::Value>::New(isolate, global_value)->IsString()); 3185 CHECK(v8::Local<v8::Value>::New(isolate, global_value)->IsString());
3186 CHECK(global_string == v8::Persistent<String>::Cast(global_value)); 3186 CHECK(global_string == v8::Persistent<String>::Cast(global_value));
3187 global_string.Dispose(); 3187 global_string.Dispose();
3188 } 3188 }
3189 3189
3190 3190
3191 THREADED_TEST(HandleEquality) {
3192 v8::Isolate* isolate = v8::Isolate::GetCurrent();
3193 v8::Persistent<String> global1;
3194 v8::Persistent<String> global2;
3195 {
3196 v8::HandleScope scope(isolate);
3197 global1.Reset(isolate, v8_str("str"));
3198 global2.Reset(isolate, v8_str("str2"));
3199 }
3200 CHECK_EQ(global1 == global1, true);
3201 CHECK_EQ(global1 != global1, false);
3202 {
3203 v8::HandleScope scope(isolate);
3204 Local<String> local1 = Local<String>::New(isolate, global1);
3205 Local<String> local2 = Local<String>::New(isolate, global2);
3206
3207 CHECK_EQ(global1 == local1, true);
3208 CHECK_EQ(global1 != local1, false);
3209 CHECK_EQ(local1 == global1, true);
3210 CHECK_EQ(local1 != global1, false);
3211
3212 CHECK_EQ(global1 == local2, false);
3213 CHECK_EQ(global1 != local2, true);
3214 CHECK_EQ(local2 == global1, false);
3215 CHECK_EQ(local2 != global1, true);
3216
3217 CHECK_EQ(local1 == local2, false);
3218 CHECK_EQ(local1 != local2, true);
3219
3220 Local<String> anotherLocal1 = Local<String>::New(isolate, global1);
3221 CHECK_EQ(local1 == anotherLocal1, true);
3222 CHECK_EQ(local1 != anotherLocal1, false);
3223 }
3224 global1.Dispose();
3225 global2.Dispose();
3226 }
3227
3228
3191 THREADED_TEST(LocalHandle) { 3229 THREADED_TEST(LocalHandle) {
3192 v8::HandleScope scope(v8::Isolate::GetCurrent()); 3230 v8::HandleScope scope(v8::Isolate::GetCurrent());
3193 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); 3231 v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
3194 CHECK_EQ(local->Length(), 3); 3232 CHECK_EQ(local->Length(), 3);
3195 3233
3196 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); 3234 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str"));
3197 CHECK_EQ(local->Length(), 3); 3235 CHECK_EQ(local->Length(), 3);
3198 } 3236 }
3199 3237
3200 3238
(...skipping 16970 matching lines...) Expand 10 before | Expand all | Expand 10 after
20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); 20209 CheckCorrectThrow("%GetLocalPropertyNames(other, true)");
20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" 20210 CheckCorrectThrow("%DefineOrRedefineAccessorProperty("
20173 "other, 'x', null, null, 1)"); 20211 "other, 'x', null, null, 1)");
20174 20212
20175 // Reset the failed access check callback so it does not influence 20213 // Reset the failed access check callback so it does not influence
20176 // the other tests. 20214 // the other tests.
20177 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); 20215 v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
20178 } 20216 }
20179 20217
20180 #endif // WIN32 20218 #endif // WIN32
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698