summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/gdscript_test_runner.cpp
AgeCommit message (Collapse)Author
2023-04-27GDScript: Use default path in test generator if not providedGeorge Marques
Since it's almost always used with the same path, assume it is running from the Godot source root. (cherry picked from commit 221deb1cc130d176c499ebc67db83e7018eafd55)
2023-02-02GDScript: Add warnings that are set to error by defaultGeorge Marques
- Adds a list of default levels for all warning so they can be set individually. - Add warnings set by default to error for: - Using `get_node()` without `@onready`. - Using `@onready` together with `@export`. - Inferring a static type with a Variant value. - Overriding a native engine method. - Adjust how annotations to ignore warnings are treated so they also apply to method parameters. - Clean up a bit how ignored warnings are set. There were two sets but only one was actually being used. - Set all warnings to the `WARN` level for tests, so they they can be properly tested. - Fix enum types in native methods signatures being set to `int`. - Fix native enums being treated as Dictionary by mistake. - Make name of native enum types use the class they are defined in, not the direct super class of the script. This ensures they are always equal even when coming from different sources. - Fix error for signature mismatch that was only showing the first default argument as having a default. Now it shows for all.
2023-02-01Revert "GDScript: Add warnings that are set to error by default"Rémi Verschelde
This reverts commit a166833bfa23a21a7bff196a85a20b014e7c1396. This caused multiple regressions. Needs to be redone with more testing before merge. Fixes #72501.
2023-02-01GDScript: Add warnings that are set to error by defaultGeorge Marques
- Adds a list of default levels for all warning so they can be set individually. - Add warnings set by default to error for: - Using `get_node()` without `@onready`. - Using `@onready` together with `@export`. - Inferring a static type with a Variant value. - Overriding a native engine method. - Adjust how annotations to ignore warnings are treated so they also apply to method parameters. - Clean up a bit how ignored warnings are set. There were two sets but only one was actually being used. - Set all warnings to the `WARN` level for tests, so they they can be properly tested. - Fix enum types in native methods signatures being set to `int`. - Fix native enums being treated as Dictionary by mistake. - Make name of native enum types use the class they are defined in, not the direct super class of the script. This ensures they are always equal even when coming from different sources. - Fix error for signature mismatch that was only showing the first default argument as having a default. Now it shows for all.
2023-01-30Add option to print filenames in GDScript unit testingocean (they/them)
2023-01-05One Copyright Update to rule them allRémi Verschelde
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
2022-11-25Fix singleton scene cyclic loadingAdam Scott
2022-11-18Fix cyclic references in GDScript 2.0Adam Scott
2022-11-13GDScript compiler subclass bugfixesRune
2022-10-07Fix more MSVC C4702 (unreachable code) warningsRémi Verschelde
2022-08-29Rename String `plus_file` to `path_join`Aaron Franke
2022-07-04Variant memory poolslawnjelly
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
2022-06-29Adding print_rich for printing with BBCodeVoylin
2022-05-16Replace most uses of Map by HashMapreduz
* 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!
2022-05-12Add a new HashMap implementationreduz
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<>
2022-05-03Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`Hugo Locurcio
These typedefs don't save much typing compared to the full `Ref<Resource>` and `Ref<RefCounted>`, yet they sometimes introduce confusion among new contributors.
2022-04-11Make FileAccess and DirAccess classes reference counted.bruvzg
2022-04-04Improve autoload inheritance error messageJason Yundt
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.
2022-03-09Remove VARIANT_ARG* macrosreduz
* 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.
2022-02-08Refactor some object type checking code with `cast_to`Rémi Verschelde
Less stringly typed logic, and less String allocations and comparisons.
2022-02-03GDScript: Allow tests to run on release buildsGeorge Marques
- 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.
2022-01-06Fix multiple missing UTF-8 decoding.bruvzg
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-09Replace String comparisons with "", String() to is_empty()Nathan Franke
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
2021-10-14Implement toast notifications in the editorGilles Roudière
2021-10-06GDScript: Make all warnings enabled in test generationGeorge Marques
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.
2021-09-13Fix an undefined behaviourThreeRhinosInAnElephantCostume
2021-09-13Merge pull request #52068 from ThreeRhinosInAnElephantCostume/fixgdscriptRémi Verschelde
Fix parse error on statement-less files with only newlines, add a warning for empty files.
2021-09-11Fix error on parsing statement-less GDScript files,ThreeRhinosInAnElephantCostume
add an empty file warning, add relevant tests.
2021-08-26Use OrderedHashMap for autoloads to preserve orderLyuma
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-11Rename Reference to RefCountedPedro J. Estébanez
2021-06-11Core: Move DirAccess and FileAccess to `core/io`Rémi Verschelde
File handling APIs are typically considered part of I/O, and we did have most `FileAccess` implementations in `core/io` already.
2021-05-24GDScript: Fix error handler for testsGeorge Marques
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.
2021-04-26Remove uses of `auto` for better readability and online code reviewsHugo Locurcio
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).
2021-04-08Add runner for GDScript testingGeorge Marques
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>