Allow specifying an empty FilePrefix and a FileSuffix from in-editor Plugin Controller
Fixes #375
Adds a new control field to gut_config_gui.gd for Script Suffix and propagates its value to the workspace config file.
Reports an error if the user specifies a suffix which does not end in .gd.
Allows file_prefix to be empty (i.e. '').
- The previous error message says it must not be empt or GUT cannot find any scripts. However, in reality an empty prefix will match all files, which is actually what the user probably wants.
Both fields retain their default values of
test_and.gdrespectively.
Adds a new test and test sample file to express the suffix matching behavior.
There do not seem to be any tests covering the gut_config_gui it self, though I'm not sure how to test such a thing.
Please let me know if you see a gap in coverage.
Wiki Text Update:
wiki/Gut-Settings-And-Methods
Add after File Prefix in the options list:
|File Suffix|The suffix used on all test files. Must end with `.gd`. This is used in conjunction with the Directory settings to find tests.|
I've run the tests locally with this configuration:
Platform: OSX 10.15.7
Godot version: 3.4.4
GUT version: 7.3.0
My updated test file still passes:
gut -gexit -gselect=test_gut_directory.gd
Output
arguments 0: /Users/brisberg/Library/Application Support/Steam/steamapps/common/Godot Engine/Godot.app/Contents/MacOS/Godot 1: --path 2: /Users/brisberg/DevProjects/forks/Gut 3: -s 4: addons/gut/gut_cmdln.gd 5: -gexit 6: -gselect=test_gut_directory.gd Current path: /Users/brisberg/DevProjects/forks/Gut Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org OpenGL ES 3.0 Renderer: Intel Iris Pro OpenGL Engine OpenGL ES Batching: ONRegistered camera FaceTime HD Camera with id 1 position 0 at index 0
--- Gut --- [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0
res://test/unit/test_gut_directory.gd.TestUsingResDirs
- test_adding_directory_loads_files [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] SCRIPT ERROR: Invalid get index 'gut_test_collector' (on base: 'Dictionary'). at: TestUsingResDirs.test_adding_directory_loads_files_for_given_suffix (res://test/unit/test_gut_directory.gd:54) [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [ERROR]: The path [res://adsf] does not exist. [Passed]: We should get here [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed]: [135] expected to equal [135]: [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed]: Should have dir1 script [Passed]: Should have dir2 script [Passed]: Should have dir3 script [Passed]: [3] expected to equal [3]: they should have passed [Orphans]: 1 new orphan in test. [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [Orphans]: 1 new orphan in script. [WARNING]: Test script still has children when all tests finisehd. @@189:Control:3263 @@283:Control:3579 @@377:Control:3822 @@471:Control:4134 @@565:Control:4372 @@659:Control:6207 @@753:Control:6443 @@847:Control:8308 You can use autofree, autoqfree, add_child_autofree, or add_child_autoqfree to automatically free objects. 7/7 passed.
res://test/unit/test_gut_directory.gd.TestUsingDynamicDirs [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed]: @@1130:Control:9142 should have getter starting with get_ or is_ [Passed]: @@1130:Control:9142 should have method: set_include_subdirectories [Passed]: [False] expected to equal [False]: It should have the expected default value. [Passed]: [True] expected to equal [True]: The set value should have been returned. [INFO]: using [/Users/brisberg/Library/Application Support/Godot/app_userdata/Gut] for temporary output. Godot version: 3.4.4 GUT version: 7.3.0 [Passed] [WARNING]: Test script still has children when all tests finisehd. @@942:Control:8630 @@1036:Control:8888 @@1130:Control:9142 @@1224:Control:9396 You can use autofree, autoqfree, add_child_autofree, or add_child_autoqfree to automatically free objects. 7/7 passed.
*** Run Summary *** All tests passed
Totals Scripts: 1 Passing tests 11 Failing tests 0 Risky tests 0 Pending: 0 Asserts: 14 of 14 passed
Warnings/Errors:
- 1 Errors.
- 2 Warnings.
11 passed 0 failed. Tests finished in 0.0s
[Orphans]: 1921 new orphans in total. Note: This count does not include GUT objects that will be freed upon exit. It also does not include any orphans created by global scripts loaded before tests were ran. Total orphans = 1924 Ran Scripts matching "test_gut_directory.gd" Results saved to user://logs/gut_results_1658730950.json
However, a full test run shows 10-11 tests which still fail and numerous warnings. These appear to be the same tests which fail from a fresh checkout of master.
Are these erroneous tests expected? Please advise if I should ignore these failures since they do not appear to be related to this change.