Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Introduce DocTest #3

Merged
merged 11 commits into from
Jul 4, 2017
Merged

Introduce DocTest #3

merged 11 commits into from
Jul 4, 2017

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Jul 3, 2017

So the goal is to basically merge RFC 52 into this RFC. With this patch, Kitab is able to compile the documentation into HTML+CSS+JS, but also able to test it!

This is still a work in progress, but it works!

cc @jubianchi @vonglasow

@Hywan Hywan self-assigned this Jul 3, 2017
@Hywan
Copy link
Member Author

Hywan commented Jul 3, 2017

Diff with RFC 52 is that we are now relying on a real PHP parser with an AST instead of the tokenizer, this is less error-prone and easier to manipulate the code. Also this is more a “all-batteries included” approach, which I think is better.

@Hywan
Copy link
Member Author

Hywan commented Jul 3, 2017

Oh, to test it: ./bin/kitab test -o src foo, and it runs. I would like to use a temporary directory, compile and test files that have changed only, and add more options to inject a custom autoloader etc etc.

@vonglasow
Copy link
Member

vonglasow commented Jul 3, 2017

@Hywan Nice, I have just look at it quickly for now and it works well. They show me an error in documentation in entity file PR will come.

OK PR done.

You can also add an option to overwrite all tests created. After tests, it looks really cool and they have raised some error on documentation or code it's cool :D

@vonglasow
Copy link
Member

@Hywan tests are generated and they don't need to be committed (as there already exists in documentation) so for me we need to add it in .gitignore file but you can choose the folder name where to export.

@jubianchi
Copy link
Member

Great feature!

The only thing that i don't really like here is that the user has to run a second command to run the generated tests. Something seems wrong to me here.

Imagine I write the doc blocks, with code snippets, and I build the doc only. I don't run the tests. I'll end up publishing a doc which is probably false. Some tests may fail but I did not run them.

It would be really awesome if tests were run directly in during the build process to ensure everything is correct.

@Hywan
Copy link
Member Author

Hywan commented Jul 4, 2017

@jubianchi OK. I will address that in another PR.

@Hywan Hywan mentioned this pull request Jul 4, 2017
Hywan added 2 commits July 4, 2017 10:39
The goal of this failure field is to hide paths where test suites are
stored. Another goal is to simplify the output with no useless
information in this particular context.
@Hywan Hywan merged commit 880b87e into master Jul 4, 2017
@Bhoat Bhoat deleted the doctest branch July 5, 2017 08:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants