Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dartdoc test -- full diff #249

Merged
merged 8 commits into from
Aug 28, 2024
Merged

Dartdoc test -- full diff #249

merged 8 commits into from
Aug 28, 2024

Conversation

jonasfj
Copy link
Member

@jonasfj jonasfj commented Aug 19, 2024

Creating a PR with all dartdoc_test related changes for review.

jonasfj and others added 7 commits May 23, 2024 12:39
* add more examples and fix extracting

* code splitting and print code samples and it's location.

* set overlay of sample code and update dart sdk
* add test

* fix

* add import

* fix indent

* move to getter

* fix for ci

* fix sdk version

* fix
* implement analyze and output samples to .dartdoc_test directory

* add CRLF/LF line breaks tests

* add license headers to all files

* add documentation and some modified

* fix extractor test and add TestContext

* update to make analyzer work

* translate original span from sample file span

* make DartDocTestContext to singleton no longer

* add example dart project

* add write options to write sample code to file (for debug)

* updated README. minor fixes

* add new analyzer test

* update example README

* update README, add .gitignore for .dartdoc_test, and create add subcommand to generate test file

* fix

* rename DartDoc -> Dartdoc

* fix extractor and add tests

* fix span translation and add test

* add CommandRunner and make some commands to subCommand

* fix

* fix analyzer and ignore warning

* fix print of analyze results

* create integration test
* move some codes to src/

* set analyze to default command, and print usage when -h flag is set

* remove extract command and fix integration_test

* add logger and varbose option

* add test for verbose

* fix log

* move log to Command
* create logger class

* add summary log

* move command

* create reporter

* fix

* add ansi and fix extractor to allow code blocks with no specified language

* add output directory option

* add extractor test

* import and print relative path

* fix format

* apply review suggestions and update Reporter

* update reporter

* use stdout reporter

* allow analyze command options in default command

* add integration test for runDartdocTest()

* update report to print relative path

* fix to work test reporter in example directory

* fix
@@ -0,0 +1 @@
## v0.1.0
Copy link
Member Author

Choose a reason for hiding this comment

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

We should write a proper changelog entry :D

@@ -0,0 +1 @@
.dartdoc_test
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we still create this, or do we create things inside .dart_tool/dartdoc_test/

Comment on lines 19 to 20
/// code block without specified language
/// ```

Choose a reason for hiding this comment

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

Should we specify here what the behaviour would be when language is not specified?

Comment on lines 3 to 4
This package provides an easy way to test code samples embedded in dartdoc
documentation comments.

Choose a reason for hiding this comment

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

Can we add what are the features it currently supports and what are some things that we would like to add in future? A list like "static analysis", "output comparison", ...

return sanitized == sanitized.split('').reversed.join('');
}

/// Should return: Local variable 'gcd' can't be referenced before it is declared.

Choose a reason for hiding this comment

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

Is there a mistake here? Why would this return an error and the isPalindrome example above won't?

Comment on lines +47 to +57
final reporter = Reporter.test(verbose: verbose);
for (final r in result) {
for (final e in r.errors) {
reporter.addIssue(Issue(
path: r.file.sample.comment.path,
message: e.error.message,
commentSpan: e.commentSpan,
generatedSpan: e.generatedSpan,
));
}
}

Choose a reason for hiding this comment

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

Would it be good to add an example of how the reporter represents the result?

Comment on lines 61 to 62
final FileSpan? commentSpan;
final FileSpan? generatedSpan;

Choose a reason for hiding this comment

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

Maybe add one-liner documentation for these properties?

* implement code sample ignoring

* add comments

* fix ignoring and test

* update documentations

* add exclude option

* fix summary and make ReporterForTest use verbose flag

* move models to model.dart

* only run integration test on ./example

* do not wrap code samples with main() when code sample includes main()

* fix

* rename code sample output directory

* add doc comments

* update ignoring to use code block tagging (dart#no-test)

* add public member documentations

* fix

* switch default output directory to

* update CHANGELOG

* fix to make some class to final

* remove Reporter constructor, add some comments, and some fixes

* add missing doc comment

* fix output code

* fix for ci

* fix readme
@jonasfj jonasfj marked this pull request as ready for review August 28, 2024 11:08
@jonasfj jonasfj merged commit d91af60 into master Aug 28, 2024
4 checks passed
@jonasfj jonasfj deleted the dartdoc_test branch August 28, 2024 11:08
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.

3 participants