summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/gdscript_test_runner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace most uses of Map by HashMapreduz2022-05-161-2/+2
| | | | | | | | | | | | * Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
* Add a new HashMap implementationreduz2022-05-121-5/+5
| | | | | | | | | | | | | | | | | Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
* Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`Hugo Locurcio2022-05-031-1/+1
| | | | | | These typedefs don't save much typing compared to the full `Ref<Resource>` and `Ref<RefCounted>`, yet they sometimes introduce confusion among new contributors.
* Make FileAccess and DirAccess classes reference counted.bruvzg2022-04-111-5/+4
|
* Improve autoload inheritance error messageJason Yundt2022-04-041-1/+1
| | | | | | | | | | | | | | Autoloaded scripts should always inherit from Node. When you run a project that tries to autoload a script which doesn’t inherit from Node, then Godot gives an error. Before this change, the error said “Script does not inherit a Node”. That error message is a little bit misleading. If a class inherits a Node, then one of its superclasses has a Node. If a class inherits _from_ Node, then one of its superclasses is Node. This change corrects that mistake. Fixes #59884.
* Remove VARIANT_ARG* macrosreduz2022-03-091-1/+1
| | | | | | | | * Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
* Refactor some object type checking code with `cast_to`Rémi Verschelde2022-02-081-10/+8
| | | | Less stringly typed logic, and less String allocations and comparisons.
* GDScript: Allow tests to run on release buildsGeorge Marques2022-02-031-0/+42
| | | | | | | | | - Fix compilation issues by disabling warnings on release builds. This also strips warnings from expected result before the comparison to avoid false mismatches. - Add a `#debug-only` flag to tests. Must be the first line of the test script. Those won't run with release builds. Can be used for test cases that rely on checks only available on debug builds.
* Fix multiple missing UTF-8 decoding.bruvzg2022-01-061-4/+4
|
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Replace String comparisons with "", String() to is_empty()Nathan Franke2021-12-091-1/+1
| | | | | | Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
* Implement toast notifications in the editorGilles Roudière2021-10-141-1/+1
|
* GDScript: Make all warnings enabled in test generationGeorge Marques2021-10-061-7/+6
| | | | | | The test generation doesn't initialize the language (since it's already initialized in main), but it still needs the warning enabled so it matches the actual tests.
* Fix an undefined behaviourThreeRhinosInAnElephantCostume2021-09-131-0/+3
|
* Merge pull request #52068 from ThreeRhinosInAnElephantCostume/fixgdscriptRémi Verschelde2021-09-131-1/+4
|\ | | | | Fix parse error on statement-less files with only newlines, add a warning for empty files.
| * Fix error on parsing statement-less GDScript files,ThreeRhinosInAnElephantCostume2021-09-111-1/+4
| | | | | | | | | | add an empty file warning, add relevant tests.
* | Use OrderedHashMap for autoloads to preserve orderLyuma2021-08-261-5/+5
|/
* Use C++ iterators for Lists in many situationsAaron Franke2021-07-231-7/+7
|
* Rename `instance()`->`instantiate()` when it's a verbLightning_A2021-06-191-4/+4
|
* Rename Reference to RefCountedPedro J. Estébanez2021-06-111-3/+3
|
* Core: Move DirAccess and FileAccess to `core/io`Rémi Verschelde2021-06-111-1/+1
| | | | | File handling APIs are typically considered part of I/O, and we did have most `FileAccess` implementations in `core/io` already.
* GDScript: Fix error handler for testsGeorge Marques2021-05-241-4/+3
| | | | | | This changes the error message to be more clear on the output files and also fixes an issue with the relative path of the offending file that was not trimmed correctly.
* Remove uses of `auto` for better readability and online code reviewsHugo Locurcio2021-04-261-2/+2
| | | | | | | | The current code style guidelines forbid the use of `auto`. Some uses of `auto` are still present, such as in UWP code (which can't be currently tested) and macros (where removing `auto` isn't easy).
* Add runner for GDScript testingGeorge Marques2021-04-081-0/+584
This is meant for testing the GDScript implementation, not for testing user scripts nor testing the engine using scripts. Tests consists in a GDScript file and a .out file with the expected output. The .out file format is: expected status (based on the enum GDScriptTest::TestStatus) on the first line, followed by either an error message or the resulting output. Warnings are added after the first line, before the output (or compiler errors) if the parser pass without any error. The test script must have a function called `test()` which takes no argument. Such function will be called by the test runner. The test should not have any dependency unless it's part of the test too. Global classes (using `class_name`) are registered before the runner starts, so those should work if needed. Use the command `godot --gdscript-generate-tests godot-source/modules/gdscript/tests/scripts` to update the .out files with the current output (make sure the output are the expected values before committing). The tests themselves are part of the doctest suite so those can be executed with `godot --test`. Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>