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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 if (Dart_IsError(tmp_handle)) { \ | 353 if (Dart_IsError(tmp_handle)) { \ |
354 dart::Expect(__FILE__, __LINE__).IsSubstring((substring), \ | 354 dart::Expect(__FILE__, __LINE__).IsSubstring((substring), \ |
355 Dart_GetError(tmp_handle)); \ | 355 Dart_GetError(tmp_handle)); \ |
356 } else { \ | 356 } else { \ |
357 dart::Expect(__FILE__, __LINE__).Fail( \ | 357 dart::Expect(__FILE__, __LINE__).Fail( \ |
358 "expected '%s' to be an error handle but found a valid handle.\n", \ | 358 "expected '%s' to be an error handle but found a valid handle.\n", \ |
359 #handle); \ | 359 #handle); \ |
360 } \ | 360 } \ |
361 } while (0) | 361 } while (0) |
362 | 362 |
| 363 #define EXPECT_TRUE(handle) \ |
| 364 do { \ |
| 365 Dart_Handle tmp_handle = (handle); \ |
| 366 if (Dart_IsBoolean(tmp_handle)) { \ |
| 367 bool value; \ |
| 368 Dart_BooleanValue(tmp_handle, &value); \ |
| 369 if (!value) { \ |
| 370 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 371 #handle); \ |
| 372 } \ |
| 373 } else { \ |
| 374 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 375 #handle); \ |
| 376 } \ |
| 377 } while (0) |
| 378 |
363 } // namespace dart | 379 } // namespace dart |
364 | 380 |
365 #endif // VM_UNIT_TEST_H_ | 381 #endif // VM_UNIT_TEST_H_ |
OLD | NEW |