| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 public: | 271 public: |
| 272 // Test the Compiler::CompileScript functionality by checking the return | 272 // Test the Compiler::CompileScript functionality by checking the return |
| 273 // value to see if no parse errors were reported. | 273 // value to see if no parse errors were reported. |
| 274 static bool TestCompileScript(const Library& library, const Script& script); | 274 static bool TestCompileScript(const Library& library, const Script& script); |
| 275 | 275 |
| 276 // Test the Compiler::CompileFunction functionality by checking the return | 276 // Test the Compiler::CompileFunction functionality by checking the return |
| 277 // value to see if no parse errors were reported. | 277 // value to see if no parse errors were reported. |
| 278 static bool TestCompileFunction(const Function& function); | 278 static bool TestCompileFunction(const Function& function); |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 #define EXPECT_VALID(handle) \ | 281 #define EXPECT_VALID(handle) \ |
| 282 if (Dart_IsError((handle))) { \ | 282 do { \ |
| 283 dart::Expect(__FILE__, __LINE__).Fail("invalid handle '%s':\n '%s'\n", \ | 283 Dart_Handle tmp_handle = (handle); \ |
| 284 #handle, Dart_GetError(handle)); \ | 284 if (Dart_IsError(tmp_handle)) { \ |
| 285 } | 285 dart::Expect(__FILE__, __LINE__).Fail( \ |
| 286 "expected '%s' to be a valid handle but found an error handle:\n" \ |
| 287 " '%s'\n", \ |
| 288 #handle, Dart_GetError(tmp_handle)); \ |
| 289 } \ |
| 290 } while (0) |
| 291 |
| 292 #define EXPECT_ERROR(handle, substring) \ |
| 293 do { \ |
| 294 Dart_Handle tmp_handle = (handle); \ |
| 295 if (Dart_IsError(tmp_handle)) { \ |
| 296 dart::Expect(__FILE__, __LINE__).IsSubstring((substring), \ |
| 297 Dart_GetError(tmp_handle)); \ |
| 298 } else { \ |
| 299 dart::Expect(__FILE__, __LINE__).Fail( \ |
| 300 "expected '%s' to be an error handle but found a valid handle.\n", \ |
| 301 #handle); \ |
| 302 } \ |
| 303 } while (0) |
| 286 | 304 |
| 287 } // namespace dart | 305 } // namespace dart |
| 288 | 306 |
| 289 #endif // VM_UNIT_TEST_H_ | 307 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |