OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
7 #include "include/dart_debugger_api.h" | 7 #include "include/dart_debugger_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3573 Dart_CreateIsolate(NULL, NULL, bin::snapshot_buffer, | 3573 Dart_CreateIsolate(NULL, NULL, bin::snapshot_buffer, |
3574 reinterpret_cast<void*>(mydata), | 3574 reinterpret_cast<void*>(mydata), |
3575 &err); | 3575 &err); |
3576 EXPECT(isolate != NULL); | 3576 EXPECT(isolate != NULL); |
3577 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData())); | 3577 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData())); |
3578 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate))); | 3578 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate))); |
3579 Dart_ShutdownIsolate(); | 3579 Dart_ShutdownIsolate(); |
3580 } | 3580 } |
3581 | 3581 |
3582 | 3582 |
3583 TEST_CASE(IsolateSetCheckedMode) { | |
3584 const char* kScriptChars = | |
3585 "int bad1() {\n" | |
3586 " int foo = 'string';\n" | |
3587 " return foo;\n" | |
3588 "}\n" | |
3589 "\n" | |
3590 "int good1() {\n" | |
3591 " int five = 5;\n" | |
3592 " return five;" | |
3593 "}\n" | |
3594 "\n" | |
3595 "int bad2() {\n" | |
regis
2015/02/04 00:00:58
not needed anymore
zra
2015/02/04 18:28:57
Removed
| |
3596 " int foo = 'string';\n" | |
3597 " return foo;\n" | |
3598 "}\n" | |
3599 "\n" | |
3600 "int good2() {\n" | |
regis
2015/02/04 00:00:58
ditto
zra
2015/02/04 18:28:58
Removed
| |
3601 " int five = 5;\n" | |
3602 " return five;" | |
3603 "}\n" | |
3604 "\n"; | |
3605 Dart_Handle result; | |
3606 | |
3607 // Create a test library and Load up a test script in it. | |
3608 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | |
3609 result = Dart_IsolateSetStrictCompilation(true); | |
3610 EXPECT_VALID(result); | |
3611 | |
3612 result = Dart_Invoke(lib, NewString("bad1"), 0, NULL); | |
3613 EXPECT_ERROR(result, "Unhandled exception:\n" | |
3614 "type 'String' is not a subtype of type 'int' of 'foo'"); | |
3615 | |
3616 result = Dart_Invoke(lib, NewString("good1"), 0, NULL); | |
3617 EXPECT_VALID(result); | |
3618 | |
3619 result = Dart_IsolateSetStrictCompilation(false); | |
3620 EXPECT_ERROR(result, "Dart_IsolateSetStrictCompilation expects that the " | |
3621 "isolate has not yet compiled code."); | |
3622 } | |
3623 | |
3624 | |
3583 TEST_CASE(DebugName) { | 3625 TEST_CASE(DebugName) { |
3584 Dart_Handle debug_name = Dart_DebugName(); | 3626 Dart_Handle debug_name = Dart_DebugName(); |
3585 EXPECT_VALID(debug_name); | 3627 EXPECT_VALID(debug_name); |
3586 EXPECT(Dart_IsString(debug_name)); | 3628 EXPECT(Dart_IsString(debug_name)); |
3587 } | 3629 } |
3588 | 3630 |
3589 | 3631 |
3590 static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) { | 3632 static void MyMessageNotifyCallback(Dart_Isolate dest_isolate) { |
3591 } | 3633 } |
3592 | 3634 |
(...skipping 5249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8842 result = Dart_Invoke(lib, | 8884 result = Dart_Invoke(lib, |
8843 NewString("testView16"), | 8885 NewString("testView16"), |
8844 1, | 8886 1, |
8845 dart_args); | 8887 dart_args); |
8846 EXPECT_VALID(result); | 8888 EXPECT_VALID(result); |
8847 EXPECT(Dart_IsString(result)); | 8889 EXPECT(Dart_IsString(result)); |
8848 } | 8890 } |
8849 } | 8891 } |
8850 | 8892 |
8851 } // namespace dart | 8893 } // namespace dart |
OLD | NEW |