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

Add unit testing #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Add unit testing #13

wants to merge 9 commits into from

Conversation

Bilal2453
Copy link
Contributor

@Bilal2453 Bilal2453 commented Oct 7, 2022

Add unit testing for most methods. This is still working in progress.

This uses the Busted unit testing framework, running on Lua 5.4 (though it should also run on any Lua version).
The tests are ran from the main tree with busted -p .-%.lua tests/. The exact details may change in later commits.

Progress:

  • ext_math
  • ext_base
  • ext_string
  • ext_coroutine
  • ext_table

@Bilal2453
Copy link
Contributor Author

Bilal2453 commented Oct 7, 2022

Busted expects a structure that looks like this:

└── spec
    ├── more_tests
    │   └── test_spec.lua
    └── test_spec.lua

(any .-%_spec.lua file inside a spec folder that is)

Should we use this instead of the current structure? All this would do is make it that we do busted to run the tests instead of adding and specifying the directory like busted -p .-%.lua tests/. We can also add a .busted file for various configurations including the patterns which would also effectively let you run busted alone.

@Bilal2453 Bilal2453 marked this pull request as ready for review July 16, 2023 21:10
@Bilal2453
Copy link
Contributor Author

Bilal2453 commented Jul 16, 2023

@truemedian Should be good enough for review! Do note the table/randomipair_spec.lua test currently fails as it is waiting merge of #27.

I changed how you run the tests, now all you need to do is busted in the root of the repository where the spec folder is located. I think the parts related to base tests are worth the review first, I am already debating rewriting those.

Also frankly, reviewing those tests is probably harder than writing them, may just want to give them a fast glance to assure nothing is severely out of place.

@Bilal2453 Bilal2453 changed the title Add tests (WiP) Add unit testing Jul 16, 2023
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.

1 participant