EXPECTF diffs are overly noisy #55

Open
opened 2026-01-24 11:40:34 +01:00 by admin · 0 comments
Owner

Originally created by @cmb69 on GitHub (Oct 22, 2019).

If test output doesn't match the --EXPECTF-- section (requires PR #80), none of the placeholders are resolved, so the diffs contain even lines which do not fail by themselves. For instance, ext/datetime/tests/DateTime_createFromImmutable.phpt produces the following diff:

@@ -1,12 +1,1 @@
+object(DateTime)#2 (3) {
-object(DateTime)#%d (3) {
@@ -11,1 +11,1 @@
 }
 bool(true)
 
+Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in D:\Users\cmb\Downloads\php-test-pack-7.4.0beta4\ext\date\tests\datetime_createfromimmutable.php on line 12
-Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
-NULL

However, only the line with the actual warning is different (as can be seen when the test is run with PR #82 applied).

Since this only makes eventual diffs somewhat harder to read, but doesn't actually affect the test results, fixing this is of lower priority.

Originally created by @cmb69 on GitHub (Oct 22, 2019). If test output doesn't match the `--EXPECTF--` section (requires PR #80), none of the placeholders are resolved, so the diffs contain even lines which do not fail by themselves. For instance, ext/datetime/tests/DateTime_createFromImmutable.phpt produces the following diff: ````.diff @@ -1,12 +1,1 @@ +object(DateTime)#2 (3) { -object(DateTime)#%d (3) { @@ -11,1 +11,1 @@ } bool(true) +Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in D:\Users\cmb\Downloads\php-test-pack-7.4.0beta4\ext\date\tests\datetime_createfromimmutable.php on line 12 -Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d -NULL ```` However, only the line with the actual warning is different (as can be seen when the test is run with PR #82 applied). Since this only makes eventual diffs somewhat harder to read, but doesn't actually affect the test results, fixing this is of lower priority.
admin added the bug label 2026-01-24 11:40:34 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: php/pftt2#55