Releases: bitwes/Gut
Minor Bug Fix
- Fixed issue where
watch_signals
was not working with "Script Signals". These are signals defined using the syntaxsignal SomeSignal
instead of usingadd_user_signal
to create them. - Fixed a link in the README
Reorg/Refactor
This version mostly contains some long overdue house cleaning. So that this wasn't JUST a reorganization release I also added an method for asserting instance type and inheritance and some minor tweaks.
Breaking Changes (kinda) from 4.1.0
This change should only affect really old tests. If you started using Gut later than 4.0 then you will most likely be ok. The best approach to adjusting your tests is just to run them and see if it tells you that you are calling any methods that have been moved and then fixing them by removing the gut.
prefix.
Due to the restructuring I've completely moved the various asserts
out of the core gut
object and put them in the test
object that all unit tests inherit from. This means that any asserts or pending calls that are prefixed with gut.
need to have the gut.
prefix removed. To cut down on the annoyance level of this change I've added stubs for the removed methods that fail with a message indicating that the method has been moved.
Version 4.1.0
4.1.0
- Added the ability to assert that signals did or did not fire. By calling
watch_signals
Gut will monitor any signals emitted by the object. You can then later make assertions about whether or not a signal was emitted or whether it emitted a desired number of times, and even if it was emitted and passed specific parameters. The following methods were added for this feature, see the README for more information about them.watch_signals
assert_signal_emitted
assert_signal_not_emitted
assert_signal_emitted_with_parameters
assert_signal_emit_count
assert_has_signal
get_signal_emit_count
get_signal_parameters
- Some minor fixes to
gut.p
- It now performs a
str
on the input. So if you pass it an object or something that isn't a string it won't blow up. - It now indents multi-line input correctly.
- It now performs a
4.0.0 Now it's a Plugin
It is a plugin now! Unfortunately that means some things and paths have changed.
Before upgrading, remove gut.gd and gut_cmdln.gd from your your current project. That will help ensure that you got everything setup right with the new install location.
Breaking changes
- The install location has changed to
res://addons/gut
. So you'll want to clean out wherever you had it previously installed. - You'll want to update your existing scene to use the new plugin object. Follow the new install instructions.
Note: just about everything you had to code to get your main testing scene running can now be configured in the Editor. Select the Gut node and the options will appear in the Inspector. Your existing code will work with the new custom node but using the Editor greatly simplifies things. - The object that all test scripts must extend has changed to
res://addons/gut/test.gd
. - All examples and tests for Gut itself have been moved to the new repo https://github.com/bitwes/GutTests/
Additions
assert_has(obj, element, text)
- Asserts that the object passed inhas
the element passed in. Works with any object that has ahas
method. Useful for testing the contents of arrays and hashes.assert_does_not_have(obj, element, text)
- The inverse ofassert_has
.
Bugs and tweaks
Run buttons
The Run button will now run the currently selected script and all scripts after it. This helps workaround the fact that you cannot catch errors that kill the program. I've found it useful when you go to run all your tests but one script blows up somewhere in the middle of the list. You can continue testing the rest to find out if you have anymore issues without having to do them one at a time.
A new button was added next to the dropdown that will only run the selected script.
Strict Type Checking with Float/Integer
I removed the strict type checking when comparing Floats and Integers. Since it really doesn't matter if you compare 1 with 1.0 and 1.1 does not equal 1 I removed it. It will print out a warning whenever you do a comparison of a Float and an Integer but it no longer fails the test.
No more end_test
when yielding
In a stroke of genius (or lack or foresight) I realized that Gut could detect the end of a yield
whenever an assertion was made. Now, as long as you use one of the assert methods or pending after a yield
, you don't have to call end_test
. You still can, it won't hurt anything, but you don't have to.
Various bug fixes.
If I did this right, the bugs fixed should be listed somewhere through the magic of Github. If not, then I'll add a list here.
3.0.0
The biggest changes were to organization and documentation and the repo is now on Github instead of Bitbucket. Some methods have been wrapped/moved/renamed to cut down on typing and to improve readability.
Nothing has been removed though and this release is completely backwards compatible with earlier versions. There is one caveat though. This release introduces strict datatype comparisons that will cause tests to fail if you are comparing two things that aren't of the same datatype. This feature can be disabled but read the section in the readme before you do.
Also some default locations for scripts have changed as far as documentation and the command line tool are concerned. See the install instructions for more details. You will need to specify the location of the gut.gd
script in the options for the command line tool if you do not change to the new default.
- asserts do not need to be prefixed with "gut" anymore
- Yielding syntax sugar improved. See
yield_for
. - Pretty major overhaul of readme. It even has a table of contents now.
- Refactored directory structure of repo.
- Refactored preferred deployment directory structure. You can still put anything anywhere you want though. It's now easier to get started with the recommended structure.
The gut.zip file below contains all the files in the test/gut directory. If you have made changes to your gut_main.gd or gut_main.scn then do not copy these files over yours.