Skip to content

ext/standard: Refactor and add {s|f}scanf tests - #20676

Open
Girgias wants to merge 9 commits into
php:masterfrom
Girgias:scanf-tests
Open

ext/standard: Refactor and add {s|f}scanf tests#20676
Girgias wants to merge 9 commits into
php:masterfrom
Girgias:scanf-tests

Conversation

@Girgias

@Girgias Girgias commented Dec 9, 2025

Copy link
Copy Markdown
Member

This is in preparation for some major refactoring.

Most of the fscanf() tests are pure garbage, as they don't actually test what they are claiming to do.
They mostly test fprintf() and/or casting various values to string on top of how PHP parses integers/floats.

As such, I suggest deleting the majority of these nonsensical tests and then write some tests that actually try to examine the behaviour of {f|s}scanf().

TODO and or follow-up:

  • Redo all tests parsing integers/floats

@Girgias
Girgias requested a review from ndossche December 9, 2025 21:02
@Girgias
Girgias marked this pull request as ready for review December 9, 2025 21:03
@Girgias
Girgias requested a review from bukka as a code owner December 9, 2025 21:03
…printf

This effectively tests scanning an empty file line or a file line only containing '1', which is already handled by the string tests
A bunch of the test cases are testing the language scanner rules rather than fscanf
This is in preparation for some major refactoring as the current error messages are non-sensical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant