| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 using ::v8::TryCatch; | 62 using ::v8::TryCatch; |
| 63 using ::v8::Undefined; | 63 using ::v8::Undefined; |
| 64 using ::v8::V8; | 64 using ::v8::V8; |
| 65 using ::v8::Value; | 65 using ::v8::Value; |
| 66 | 66 |
| 67 static void ExpectInt32(int32_t expected, Local<Value> result) { | 67 static void ExpectInt32(int32_t expected, Local<Value> result) { |
| 68 CHECK(result->IsInt32()); | 68 CHECK(result->IsInt32()); |
| 69 CHECK_EQ(expected, result->Int32Value()); | 69 CHECK_EQ(expected, result->Int32Value()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 |
| 72 // Global variables. | 73 // Global variables. |
| 73 TEST(global_variables) { | 74 TEST(global_variables) { |
| 74 v8::HandleScope scope; | 75 v8::HandleScope scope; |
| 75 LocalContext env; | 76 LocalContext env; |
| 76 Local<Value> result = CompileRun( | 77 Local<Value> result = CompileRun( |
| 77 "var x = 0;" | 78 "var x = 0;" |
| 78 "function f0() { return x; }" | 79 "function f0() { return x; }" |
| 79 "f0();"); | 80 "f0();"); |
| 80 ExpectInt32(0, result); | 81 ExpectInt32(0, result); |
| 81 } | 82 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 TEST(lookup_slots) { | 136 TEST(lookup_slots) { |
| 136 v8::HandleScope scope; | 137 v8::HandleScope scope; |
| 137 LocalContext env; | 138 LocalContext env; |
| 138 Local<Value> result = CompileRun( | 139 Local<Value> result = CompileRun( |
| 139 "function f5(x) {" | 140 "function f5(x) {" |
| 140 " with ({}) return x;" | 141 " with ({}) return x;" |
| 141 "}" | 142 "}" |
| 142 "f5(5);"); | 143 "f5(5);"); |
| 143 ExpectInt32(5, result); | 144 ExpectInt32(5, result); |
| 144 } | 145 } |
| OLD | NEW |