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_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ | 24 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ |
25 void Dart_Test##name() | 25 void Dart_Test##name() |
26 | 26 |
27 // The TEST_CASE macro is used for tests that need an isolate and zone | 27 // The TEST_CASE macro is used for tests that need an isolate and zone |
28 // in order to test its functionality. | 28 // in order to test its functionality. |
29 #define TEST_CASE(name) \ | 29 #define TEST_CASE(name) \ |
30 static void Dart_TestHelper##name(); \ | 30 static void Dart_TestHelper##name(); \ |
31 UNIT_TEST_CASE(name) \ | 31 UNIT_TEST_CASE(name) \ |
32 { \ | 32 { \ |
33 TestIsolateScope __test_isolate__; \ | 33 TestIsolateScope __test_isolate__; \ |
34 Zone __zone__(__test_isolate__.isolate()); \ | 34 StackZone __zone__(__test_isolate__.isolate()); \ |
35 HandleScope __hs__(__test_isolate__.isolate()); \ | 35 HandleScope __hs__(__test_isolate__.isolate()); \ |
36 Dart_TestHelper##name(); \ | 36 Dart_TestHelper##name(); \ |
37 } \ | 37 } \ |
38 static void Dart_TestHelper##name() | 38 static void Dart_TestHelper##name() |
39 | 39 |
40 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test | 40 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test |
41 // for the assembler. | 41 // for the assembler. |
42 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ | 42 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ |
43 void AssemblerTestGenerate##name(Assembler* assembler) | 43 void AssemblerTestGenerate##name(Assembler* assembler) |
44 | 44 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } else { \ | 304 } else { \ |
305 dart::Expect(__FILE__, __LINE__).Fail( \ | 305 dart::Expect(__FILE__, __LINE__).Fail( \ |
306 "expected '%s' to be an error handle but found a valid handle.\n", \ | 306 "expected '%s' to be an error handle but found a valid handle.\n", \ |
307 #handle); \ | 307 #handle); \ |
308 } \ | 308 } \ |
309 } while (0) | 309 } while (0) |
310 | 310 |
311 } // namespace dart | 311 } // namespace dart |
312 | 312 |
313 #endif // VM_UNIT_TEST_H_ | 313 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |