Skip to content

fix: detect all main function variations in code samples#396

Open
assassinaj602 wants to merge 3 commits into
google:masterfrom
assassinaj602:fix-main-detection
Open

fix: detect all main function variations in code samples#396
assassinaj602 wants to merge 3 commits into
google:masterfrom
assassinaj602:fix-main-detection

Conversation

@assassinaj602

Copy link
Copy Markdown

Description

Fixes issue where dartdoc_test fails when main() returns Future or has no return type.

The Problem

The hasMain getter only detected void main(), causing failures for:

  • Future<void> main()
  • main() (no return type)
  • Future main()

What I Changed

  • Updated hasMain in lib/src/model.dart to use regex
  • Now detects all main function declarations

Testing

  • void main() works
  • Future<void> main() works
  • main() works
  • Future main() works
  • All existing tests pass

Closes #251

The Summary class was counting errors with commentSpan differently from
the isFailed check, causing 'FAILED: 0 issues found' when errors existed
but without commentSpan.

Now both isFailed and errors count use the same consistent logic.

Fixes google#275
The hasMain getter only detected 'void main()', causing failures for:
- Future<void> main()
- main() (no return type)
- Future main()

Now uses regex to detect all main function declarations.

Fixes google#251
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.

dartdoc_test with a main that is not void fails

1 participant