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 21083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21094 CHECK(!try_catch.HasCaught()); | 21094 CHECK(!try_catch.HasCaught()); |
21095 } | 21095 } |
21096 | 21096 |
21097 { | 21097 { |
21098 v8::TryCatch try_catch; | 21098 v8::TryCatch try_catch; |
21099 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; | 21099 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; |
21100 fun->Call(v8::Undefined(isolate), arraysize(args), args); | 21100 fun->Call(v8::Undefined(isolate), arraysize(args), args); |
21101 CHECK(!try_catch.HasCaught()); | 21101 CHECK(!try_catch.HasCaught()); |
21102 } | 21102 } |
21103 } | 21103 } |
| 21104 |
| 21105 |
| 21106 TEST(ExtrasExportsObject) { |
| 21107 v8::Isolate* isolate = CcTest::isolate(); |
| 21108 v8::HandleScope handle_scope(isolate); |
| 21109 LocalContext env; |
| 21110 |
| 21111 // standalone.gypi ensures we include the test-extra.js file, which should |
| 21112 // add the testExtraShouldReturnFive export |
| 21113 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); |
| 21114 |
| 21115 auto func = |
| 21116 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); |
| 21117 auto undefined = v8::Undefined(isolate); |
| 21118 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); |
| 21119 |
| 21120 CHECK(result->Value() == 5.0); |
| 21121 } |
OLD | NEW |