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

WIP: More rigorous testing #218

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

charlieturndorf
Copy link

@charlieturndorf charlieturndorf commented Jan 27, 2022

As suggested by @haf in #155, I'm working on updating Hopac's testing approach to be more rigorous.

  • Bootstrap a new test project using Expecto.FsCheck
  • Add tests based on AdHocTests, and make an effort to label them
  • Add tests based on @haf's Hopac.Tests in Adding unit tests to the Hopac solution #155
  • Optional: add any additional tests we want merged with this PR
  • Add simple cmd & bash scripts for build/init/test (you won't have to use these if you don't want)
  • Community: test bash scripts
  • Add test utils:
    • A Cleanup attribute so we can mark methods to be run after all tests finish executing. Might be useful for tests that need shared disposables.
    • Useful generators for FsCheck (see Gens.fs)
  • Optional: automate testing when PRs are submitted

Please do let me know if you have any thoughts on what I'm doing here. I'd be happy to adjust my approach, or focus on what's important to the community.

F# in VS Code uses .ionide folder that shouldn't be checked in
Added build & init scripts for cmd and bash, to support cross-platform development outside of Visual Studio
Added a new Scripts solution folder to avoid cluttering the Root folder
- Added Tests/Hopac.Tests project using Expecto.FsCheck
- Build & run is working but no tests are in yet
- Added test script for both cmd and bash
@charlieturndorf charlieturndorf marked this pull request as draft January 27, 2022 22:27
- I didn't see a style guide for Hopac, but it seems like 2-space indents are the norm here
- Also switched Hopac.Tests entry point to Main.fs
- Simple float math
- Generators for FsCheck property tests
- `testProp` family of functions for writing property tests
Converted tests in AdHocTests/JobTests.fs to unit tests in Hopac.Tests
@charlieturndorf
Copy link
Author

If someone on Mac/Linux could test these bash scripts, that would be a big help. I'm not sure I did them right.

Concurrent equivalents for tests in AdHocTests/JobTests.fs
- Allows us to ensure correct behavior under stress
( *<+->- ) commits on taking the reply, so it's wrong to say the client would commit before the server has sent the reply. The nack is unavailable so long as the client has not committed to another branch of the alt.
- Added tests inspired by AdHocTests/IVarTests.fs
- Wrote additional IVar tests
- Added `getCaughtExnDiff` util function
Unit tests using Job.conCollect for concurrent tests shouldn't rely on the stable order of the results. This behavior is not documented, so it might change and break the test
- Added tests based on AdHocTests/MVarTests.fs
- Added additional tests to cover the entire API surface of MVar
- Tests inspired by AdHocTests.TaskTests
- Additional tests to cover all Task interop functions under: Job, Alt, Extensions.Task, and Hopac (top-level)
Cover all Async interop functions under Job and Alt
@haf
Copy link
Member

haf commented Feb 24, 2022

Thank you for giving this project some love ❤️

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.

None yet

2 participants