(func, name, properties)
| 524 | * API functions |
| 525 | */ |
| 526 | function test(func, name, properties) |
| 527 | { |
| 528 | if (tests.promise_setup_called) { |
| 529 | tests.status.status = tests.status.ERROR; |
| 530 | tests.status.message = '`test` invoked after `promise_setup`'; |
| 531 | tests.complete(); |
| 532 | } |
| 533 | var test_name = name ? name : test_environment.next_default_test_name(); |
| 534 | var test_obj = new Test(test_name, properties); |
| 535 | var value = test_obj.step(func, test_obj, test_obj); |
| 536 | |
| 537 | if (value !== undefined) { |
| 538 | var msg = "Test named \"" + test_name + |
| 539 | "\" inappropriately returned a value"; |
| 540 | |
| 541 | try { |
| 542 | if (value && value.hasOwnProperty("then")) { |
| 543 | msg += ", consider using `promise_test` instead"; |
| 544 | } |
| 545 | } catch (err) {} |
| 546 | |
| 547 | tests.status.status = tests.status.ERROR; |
| 548 | tests.status.message = msg; |
| 549 | } |
| 550 | |
| 551 | if (test_obj.phase === test_obj.phases.STARTED) { |
| 552 | test_obj.done(); |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | function async_test(func, name, properties) |
| 557 | { |
no test coverage detected
searching dependent graphs…