mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
Compare lines without involving linebreaks
Fixes tests failing under Windows environments for any linebreak character differences
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
it('example')->assertTrue(true);
|
||||
it('example 1')->assertTrue(true);
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
it('example')->assertTrue(true);
|
||||
it('example 2')->assertTrue(true);
|
||||
|
||||
@ -11,24 +11,19 @@ $run = function (string $target) {
|
||||
};
|
||||
|
||||
test('allows to run a single test', function () use ($run) {
|
||||
assertStringContainsString(<<<EOF
|
||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
||||
✓ it example
|
||||
|
||||
Tests: 1 passed
|
||||
EOF, $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'));
|
||||
$output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php');
|
||||
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||
assertStringContainsString(' ✓ it example 1', $output);
|
||||
assertStringContainsString(' Tests: 1 passed', $output);
|
||||
});
|
||||
|
||||
test('allows to run a directory', function () use ($run) {
|
||||
assertStringContainsString(<<<EOF
|
||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
||||
✓ it example
|
||||
|
||||
PASS Tests\Fixtures\ExampleTest
|
||||
✓ it example
|
||||
|
||||
Tests: 2 passed
|
||||
EOF, $run('tests/Fixtures'));
|
||||
$output = $run('tests/Fixtures');
|
||||
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||
assertStringContainsString(' ✓ it example 1', $output);
|
||||
assertStringContainsString(' PASS Tests\Fixtures\ExampleTest', $output);
|
||||
assertStringContainsString(' ✓ it example 2', $output);
|
||||
assertStringContainsString(' Tests: 2 passed', $output);
|
||||
});
|
||||
|
||||
it('has ascii chars (decorated printer)', function () {
|
||||
@ -40,12 +35,9 @@ it('has ascii chars (decorated printer)', function () {
|
||||
|
||||
$process->run();
|
||||
$output = $process->getOutput();
|
||||
assertStringContainsString(<<<EOF
|
||||
\e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m
|
||||
\e[32;1m✓\e[39;22m\e[39m \e[2mit example\e[22m\e[39m
|
||||
|
||||
\e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m
|
||||
EOF, $output);
|
||||
assertStringContainsString(" \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m", $output);
|
||||
assertStringContainsString(" \e[32;1m✓\e[39;22m\e[39m \e[2mit example 1\e[22m\e[39m", $output);
|
||||
assertStringContainsString(" \e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m", $output);
|
||||
});
|
||||
|
||||
it('disable decorating printer when colors is set to never', function () {
|
||||
@ -58,10 +50,7 @@ it('disable decorating printer when colors is set to never', function () {
|
||||
$process->run();
|
||||
$output = $process->getOutput();
|
||||
|
||||
assertStringContainsString(<<<EOF
|
||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
||||
✓ \e[2mit example\e[22m
|
||||
|
||||
Tests: 1 passed
|
||||
EOF, $output);
|
||||
assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output);
|
||||
assertStringContainsString(" ✓ \e[2mit example 1\e[22m", $output);
|
||||
assertStringContainsString(' Tests: 1 passed', $output);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user