Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- `Innmind\BlackBox\Runner\Assert::debug()`

### Changed

- Requires PHP `8.4`
Expand Down
66 changes: 66 additions & 0 deletions proofs/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,70 @@ static function($assert) {
},
)
->tag(Tag::ci, Tag::local);

yield $prove
->test(
'Debug variables are resetted between proofs',
static function($assert) {
$io = Collect::new();

$result = Application::new([])
->displayOutputVia($io)
->displayErrorVia($io)
->usePrinter(Standard::withoutColors())
->tryToProve(static function($prove) {
yield $prove->test(
'example',
static fn($assert) => $assert
->debug('foo', true)
->true(false),
);

yield $prove->test(
'example',
static fn($assert) => $assert
->debug('foo', false)
->true(false),
);
});

$assert->false($result->successful());
$assert
->string($io->toString())
->contains('$foo = true')
->contains('$foo = false');
},
)
->tag(Tag::ci, Tag::local);

yield $prove
->test(
'Debug variables are resetted when shrinking',
static function($assert) {
$io = Collect::new();

$result = Application::new([])
->displayOutputVia($io)
->displayErrorVia($io)
->usePrinter(Standard::withoutColors())
->tryToProve(static function($prove) {
yield $prove
->proof('example')
->given(Set::integers()->between(0, 100))
->test(
static fn($assert, $i) => $assert
->debug('i'.$i, $i)
->true(false),
);
});

$assert->false($result->successful());
$assert
->string($io->toString())
->contains('$i0 = 0')
->not()
->contains('$i1 = 1');
},
)
->tag(Tag::ci, Tag::local);
};
Loading
Loading