wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

Add mocks for Quest and QuestItem natives. #1060

Closed thecadorn closed 2 years ago

thecadorn commented 2 years ago

Natives which have some visible effect are mocked out (QuestSetCompleted, IsQuestCompleted, etc...). Others are just no-ops.

I couldn't find prior examples of how to test mocks for their correctness, so no unit tests are added to the repository. These changes were manually test with a local rebuild of the repository and running Wurstscript unit tests that rely on the mocks being available. The tests fail at HEAD and succeed with these changes.

Also didn't see a style guide, and Java is not my primary language. Suggestions are welcome!

Frotty commented 2 years ago

Thanks, seems good. The only suggestion I have is to initialize the Mock object attributes, otherwise they might be uninitialized.

thecadorn commented 2 years ago

Thanks for the suggestion! Changes made.

Frotty commented 2 years ago

Cool, thanks for the contribution. Are you gonna add stdlib tests as well?