Skip to content

test(extgen): tighten parser tests by asserting warnings and dropping misleading conditionals#2381

Merged
alexandre-daubois merged 1 commit into
php:mainfrom
alexandre-daubois:chore/extgen-test-hardening
May 12, 2026
Merged

test(extgen): tighten parser tests by asserting warnings and dropping misleading conditionals#2381
alexandre-daubois merged 1 commit into
php:mainfrom
alexandre-daubois:chore/extgen-test-hardening

Conversation

@alexandre-daubois
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens internal/extgen parser tests by replacing conditional assertions with per-test assert callbacks, adding explicit coverage for invalid/orphan directives, and ensuring warnings are asserted when parsers intentionally emit them. It also makes integration tests skip (instead of fail) when external dependencies (PHP sources, xcaddy, php-config) are not available.

Changes:

  • Refactor parser table tests (func/const/class) to use expect + optional assert callbacks, removing name-based conditional assertions.
  • Add func parser tests for invalid signatures being dropped and orphan //export_php:function directives surfacing as errors.
  • Capture and assert parser warnings in tests, and switch integration prereq failures to t.Skip.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/extgen/integration_test.go Skip integration tests when required external tools/files are missing (instead of failing).
internal/extgen/helpers_test.go Add captureStdout helper for warning assertions (needs robustness fixes).
internal/extgen/funcparser_test.go Tighten func parser assertions; add new directive/signature tests; assert warning output.
internal/extgen/constparser_test.go Tighten constant parser assertions via callbacks; simplify error test expectations.
internal/extgen/classparser_test.go Tighten class parser assertions via callbacks; remove misleading conditionals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/extgen/helpers_test.go Outdated
@alexandre-daubois alexandre-daubois force-pushed the chore/extgen-test-hardening branch 4 times, most recently from 03317df to 2b125ff Compare May 12, 2026 13:30
@alexandre-daubois alexandre-daubois force-pushed the chore/extgen-test-hardening branch from 2b125ff to 88dd4b1 Compare May 12, 2026 13:43
@alexandre-daubois alexandre-daubois merged commit d7f582a into php:main May 12, 2026
14 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants