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 unittests for item movement code #11885

Merged
merged 3 commits into from
Sep 27, 2022
Merged

Add unittests for item movement code #11885

merged 3 commits into from
Sep 27, 2022

Conversation

savilli
Copy link
Contributor

@savilli savilli commented Dec 23, 2021

See #11882
Let's start with basic unit tests.

To do

This PR is Ready for Review.

How to test

./minetest --run-unittests

@savilli savilli requested a review from sfan5 December 25, 2021 16:14
@sfan5 sfan5 added the Rebase needed The PR needs to be rebased by its author. label Apr 10, 2022
@rubenwardy rubenwardy added the Concept approved Approved by a core dev: PRs welcomed! label Apr 25, 2022
@savilli
Copy link
Contributor Author

savilli commented Apr 29, 2022

Rebased

@sfan5 sfan5 removed the Rebase needed The PR needs to be rebased by its author. label Apr 30, 2022
@Zughy
Copy link
Member

Zughy commented Jun 12, 2022

Aaaand... another rebase needed, sorry :\

@Zughy Zughy added the Rebase needed The PR needs to be rebased by its author. label Jun 12, 2022
@savilli savilli mentioned this pull request Jun 13, 2022
@savilli
Copy link
Contributor Author

savilli commented Jun 13, 2022

How about a core dev reviews it first, and I rebase it after? Right now it looks quite pointless to rebase.

@savilli
Copy link
Contributor Author

savilli commented Jun 29, 2022

Rebased and fixed the issues

@Zughy Zughy removed the Rebase needed The PR needs to be rebased by its author. label Jun 29, 2022
Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Looks good, makes sense, works. 👍

Copy link
Contributor

@TurkeyMcMac TurkeyMcMac left a comment

Choose a reason for hiding this comment

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

Looks good, just one thing.

Comment on lines 55 to 56
server_scripting.loadMod(Server::getBuiltinLuaPath() + DIR_DELIM "tests" +
DIR_DELIM "helper_moveaction.lua", BUILTIN_MOD_NAME);
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't you put helper_moveaction.lua in a mod inside the unittests directory similar to test_mod?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@SmallJoker SmallJoker Sep 28, 2022

Choose a reason for hiding this comment

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

@TurkeyMcMac What's the idea behind scattering the Lua files more?
#11885 (comment)

EDIT: This path will only work when the unittest is run from the build directory, that's however not guaranteed.

Copy link
Contributor

Choose a reason for hiding this comment

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

C++ test helper code shouldn't be in builtin IMO, especially given that the C++ unit tests are only optionally included in the executable. There is already precedent for putting Lua in the unittests directory.

Copy link
Member

@SmallJoker SmallJoker Sep 29, 2022

Choose a reason for hiding this comment

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

builtin files are distributed to clients, those in unittests not. I yet have to confirm this, but I can imagine that Windows users (or basically any end-user) cannot run this unittest due to path mismatches (and missing script file).

Copy link
Contributor

Choose a reason for hiding this comment

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

There are already directories test_mod and test_world inside unittests. They are used in some other unit test code.

Copy link
Contributor

@TurkeyMcMac TurkeyMcMac left a comment

Choose a reason for hiding this comment

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

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants