Conversation
Collaborator
|
That is very impressive. Congratulations. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR gives
lwt.mla new test suite.Pretty much every API is tested. The coverage of
lwt.mlis something like 88%, and the code not covered falls into three categories:assert falsecases and the like), most of which is eliminated by the use of GADTs in the pendinglwt.mlrefactoring. This is most of the code not covered.exitor is part ofatexit, because I didn't want to kill the testing process.The thoroughness of the test suite extends well beyond coverage. Besides testing various promise state transition sequences, the test suite checks the interaction of cancelation and of storage with all relevant APIs. Of course, there are some oversights, as it's hard to be fully thorough here, but we can fill in the gaps as we find them.
The number of test cases is increased from 62 to 342. The new tests tend to be more fine-grained and focused, however, so this comparison is not completely fair. One complex existing test,
on_cancel race condition, has no direct counterpart in the new test suite. Otherwise, as far as I can tell, everything tested by the old test suite is tested by the new one. If we decide that we need exactlyon_cancel race conditionlater, we can restore it from history.All tests now have names (instead of numbers). I tried to make the meaning of each test self-evident, based on only the test name and the code, but some tests have natural-language comments attached. Perhaps, more comments will have to be added.
The test suite is broken up into logical sections, and it's probably easiest to read it with code folding. Otherwise, you just see a massive amount of repetitive OCaml text.
This test suite automatically checks a considerable proportion of what I've learned about the semantics of
lwt.ml. That should make the Lwt core easier to edit, especially (and hopefully) after the upcoming refactoring PR.Ultimately, this was triggered by trying to write the new manual, for the many users, especially newcomers, confused by the semantics of Lwt. I found that I don't know the detailed semantics myself, and maybe only a few people do. So, I started reading
lwt.mlvery thoroughly. That led to some refactoring, which led to this test suite.