| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef VM_UNIT_TEST_H_ | 5 #ifndef VM_UNIT_TEST_H_ |
| 6 #define VM_UNIT_TEST_H_ | 6 #define VM_UNIT_TEST_H_ |
| 7 | 7 |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 | 9 |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ | 27 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ |
| 28 void Dart_Test##name() | 28 void Dart_Test##name() |
| 29 | 29 |
| 30 // The TEST_CASE macro is used for tests that need an isolate and zone | 30 // The TEST_CASE macro is used for tests that need an isolate and zone |
| 31 // in order to test its functionality. | 31 // in order to test its functionality. |
| 32 #define TEST_CASE(name) \ | 32 #define TEST_CASE(name) \ |
| 33 static void Dart_TestHelper##name(); \ | 33 static void Dart_TestHelper##name(); \ |
| 34 UNIT_TEST_CASE(name) \ | 34 UNIT_TEST_CASE(name) \ |
| 35 { \ | 35 { \ |
| 36 TestIsolateScope __test_isolate__; \ | 36 TestIsolateScope __test_isolate__; \ |
| 37 StackZone __zone__(__test_isolate__.isolate()); \ | 37 Thread* __thread__ = Thread::Current(); \ |
| 38 HandleScope __hs__(__test_isolate__.isolate()); \ | 38 ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \ |
| 39 StackZone __zone__(__thread__); \ |
| 40 HandleScope __hs__(__thread__); \ |
| 39 Dart_TestHelper##name(); \ | 41 Dart_TestHelper##name(); \ |
| 40 } \ | 42 } \ |
| 41 static void Dart_TestHelper##name() | 43 static void Dart_TestHelper##name() |
| 42 | 44 |
| 43 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test | 45 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test |
| 44 // for the assembler. | 46 // for the assembler. |
| 45 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ | 47 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ |
| 46 void AssemblerTestGenerate##name(Assembler* assembler) | 48 void AssemblerTestGenerate##name(Assembler* assembler) |
| 47 | 49 |
| 48 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test | 50 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } \ | 426 } \ |
| 425 } else { \ | 427 } else { \ |
| 426 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 428 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 427 #handle); \ | 429 #handle); \ |
| 428 } \ | 430 } \ |
| 429 } while (0) | 431 } while (0) |
| 430 | 432 |
| 431 } // namespace dart | 433 } // namespace dart |
| 432 | 434 |
| 433 #endif // VM_UNIT_TEST_H_ | 435 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |