OLD | NEW |
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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 ExpectObject("\"test\"", the_string); | 1583 ExpectObject("\"test\"", the_string); |
1584 v8::Handle<v8::Value> new_boxed_string = v8::StringObject::New(the_string); | 1584 v8::Handle<v8::Value> new_boxed_string = v8::StringObject::New(the_string); |
1585 CHECK(new_boxed_string->IsStringObject()); | 1585 CHECK(new_boxed_string->IsStringObject()); |
1586 as_boxed = new_boxed_string.As<v8::StringObject>(); | 1586 as_boxed = new_boxed_string.As<v8::StringObject>(); |
1587 the_string = as_boxed->ValueOf(); | 1587 the_string = as_boxed->ValueOf(); |
1588 CHECK(!the_string.IsEmpty()); | 1588 CHECK(!the_string.IsEmpty()); |
1589 ExpectObject("\"test\"", the_string); | 1589 ExpectObject("\"test\"", the_string); |
1590 } | 1590 } |
1591 | 1591 |
1592 | 1592 |
| 1593 TEST(StringObjectDelete) { |
| 1594 LocalContext context; |
| 1595 v8::HandleScope scope(context->GetIsolate()); |
| 1596 v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")"); |
| 1597 CHECK(boxed_string->IsStringObject()); |
| 1598 v8::Handle<v8::Object> str_obj = boxed_string.As<v8::Object>(); |
| 1599 CHECK(!str_obj->Delete(2)); |
| 1600 CHECK(!str_obj->Delete(v8_num(2))); |
| 1601 } |
| 1602 |
| 1603 |
1593 THREADED_TEST(NumberObject) { | 1604 THREADED_TEST(NumberObject) { |
1594 LocalContext env; | 1605 LocalContext env; |
1595 v8::HandleScope scope(env->GetIsolate()); | 1606 v8::HandleScope scope(env->GetIsolate()); |
1596 v8::Handle<Value> boxed_number = CompileRun("new Number(42)"); | 1607 v8::Handle<Value> boxed_number = CompileRun("new Number(42)"); |
1597 CHECK(boxed_number->IsNumberObject()); | 1608 CHECK(boxed_number->IsNumberObject()); |
1598 v8::Handle<Value> unboxed_number = CompileRun("42"); | 1609 v8::Handle<Value> unboxed_number = CompileRun("42"); |
1599 CHECK(!unboxed_number->IsNumberObject()); | 1610 CHECK(!unboxed_number->IsNumberObject()); |
1600 v8::Handle<Value> boxed_not_number = CompileRun("new Boolean(false)"); | 1611 v8::Handle<Value> boxed_not_number = CompileRun("new Boolean(false)"); |
1601 CHECK(!boxed_not_number->IsNumberObject()); | 1612 CHECK(!boxed_not_number->IsNumberObject()); |
1602 v8::Handle<v8::NumberObject> as_boxed = boxed_number.As<v8::NumberObject>(); | 1613 v8::Handle<v8::NumberObject> as_boxed = boxed_number.As<v8::NumberObject>(); |
(...skipping 19514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21117 // add the testExtraShouldReturnFive export | 21128 // add the testExtraShouldReturnFive export |
21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); | 21129 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); |
21119 | 21130 |
21120 auto func = | 21131 auto func = |
21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); | 21132 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); |
21122 auto undefined = v8::Undefined(isolate); | 21133 auto undefined = v8::Undefined(isolate); |
21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); | 21134 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); |
21124 | 21135 |
21125 CHECK(result->Value() == 5.0); | 21136 CHECK(result->Value() == 5.0); |
21126 } | 21137 } |
OLD | NEW |