Chromium Code Reviews| 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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 context.Check( | 916 context.Check( |
| 917 "'use strict';" | 917 "'use strict';" |
| 918 "g({});0", | 918 "g({});0", |
| 919 EXPECT_RESULT, Number::New(CcTest::isolate(), 0)); | 919 EXPECT_RESULT, Number::New(CcTest::isolate(), 0)); |
| 920 context.Check("f({})", EXPECT_RESULT, Number::New(CcTest::isolate(), 15)); | 920 context.Check("f({})", EXPECT_RESULT, Number::New(CcTest::isolate(), 15)); |
| 921 context.Check("h({})", EXPECT_RESULT, number_string); | 921 context.Check("h({})", EXPECT_RESULT, number_string); |
| 922 } | 922 } |
| 923 } | 923 } |
| 924 | 924 |
| 925 | 925 |
| 926 TEST(CrossScriptGlobal0) { | |
|
Michael Starzinger
2015/04/22 12:42:18
nit: Do we need to add this test, since it's just
| |
| 927 HandleScope handle_scope(CcTest::isolate()); | |
| 928 { | |
| 929 SimpleContext context; | |
| 930 | |
| 931 context.Check( | |
| 932 "var global = this;" | |
| 933 "global.x = 255;" | |
| 934 "x", | |
| 935 EXPECT_RESULT, Number::New(CcTest::isolate(), 255)); | |
| 936 context.Check( | |
| 937 "'use strict';" | |
| 938 "let x = 1;" | |
| 939 "global.x", | |
| 940 EXPECT_RESULT, Number::New(CcTest::isolate(), 255)); | |
| 941 context.Check("global.x = 15; x", EXPECT_RESULT, | |
| 942 Number::New(CcTest::isolate(), 1)); | |
| 943 } | |
| 944 } | |
| 945 | |
| 946 | |
| 926 TEST(CrossScriptGlobal) { | 947 TEST(CrossScriptGlobal) { |
| 927 HandleScope handle_scope(CcTest::isolate()); | 948 HandleScope handle_scope(CcTest::isolate()); |
| 928 { | 949 { |
| 929 SimpleContext context; | 950 SimpleContext context; |
| 930 | 951 |
| 931 context.Check( | 952 context.Check( |
| 932 "var global = this;" | 953 "var global = this;" |
| 933 "global.x = 255;" | 954 "global.x = 255;" |
| 934 "x", | 955 "x", |
| 935 EXPECT_RESULT, Number::New(CcTest::isolate(), 255)); | 956 EXPECT_RESULT, Number::New(CcTest::isolate(), 255)); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1241 Undefined(CcTest::isolate())); | 1262 Undefined(CcTest::isolate())); |
| 1242 for (int i = 0; i < 4; i++) { | 1263 for (int i = 0; i < 4; i++) { |
| 1243 context.Check("f()", EXPECT_EXCEPTION); | 1264 context.Check("f()", EXPECT_EXCEPTION); |
| 1244 } | 1265 } |
| 1245 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, | 1266 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, |
| 1246 Undefined(CcTest::isolate())); | 1267 Undefined(CcTest::isolate())); |
| 1247 | 1268 |
| 1248 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); | 1269 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); |
| 1249 } | 1270 } |
| 1250 } | 1271 } |
| OLD | NEW |