summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/gdscript_test_runner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GDScriptTestRunner: Fix compiler error outputrune-scape2024-07-231-1/+1
|
* Use Core/Scene stringnames consistentlykobewi2024-05-131-1/+0
|
* Reduce and prevent unnecessary random-access to `List`A Thousand Ships2024-05-041-2/+2
| | | | | | | | | Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable
* GDScript: Fix continuation lines in `GDScriptTokenizerBuffer`Danil Alexeev2024-04-101-7/+16
|
* GDScript: Enable compression on exportGeorge Marques2024-02-081-1/+1
| | | | | | | | Besides the regular option to export GDScript as binary tokens, this also includes a compression option on top of it. The binary format needs to encode some information which generally makes it bigger than the source text. This option reduces that difference by using Zstandard compression on the buffer.
* GDScript: Reintroduce binary tokenization on exportGeorge Marques2024-02-081-14/+82
| | | | | | | | | | | | | | | | This adds back a function available in 3.x: exporting the GDScript files in a binary form by converting the tokens recognized by the tokenizer into a data format. It is enabled by default on export but can be manually disabled. The format helps with loading times since, the tokens are easily reconstructed, and with hiding the source code, since recovering it would require a specialized tool. Code comments are not stored in this format. The `--test` command can also include a `--use-binary-tokens` flag which will run the GDScript tests with the binary format instead of the regular source code by converting them in-memory before the test runs.
* Add unit test runner for autocompletionHolonProduction2024-01-051-1/+1
|
* Correctly check scripts that must inherit `EditorPlugin`Yuri Sizov2023-11-231-6/+5
| | | | | Also updates some error messages related to this kind of check across the codebase.
* GDScript: Add `INFERRED_DECLARATION` warningDanil Alexeev2023-09-221-1/+1
|
* Add "untyped_declaration" warningryanabx2023-09-111-0/+4
|
* GDScript: Further restrict test error output for C++ errorsRémi Verschelde2023-06-141-9/+9
| | | | MSVC and GCC/Clang also have different function names...
* GDScript: Only include script file path in test error outputRémi Verschelde2023-06-141-4/+10
| | | | | | | Errors originating in C++ files cause unnecessary diffs whenever the engine is updated (line number changes, etc.) and would cause CI failures due to different formatting of the file path on Windows (backslashes, worked around here anyway) and when using SCU builds (`../scu` insert).
* Add support for static variables in GDScriptGeorge Marques2023-04-271-8/+8
| | | | | | | | | | Which allows editable data associated with a particular class instead of the instance. Scripts with static variables are kept in memory indefinitely unless the `@static_unload` annotation is used or the `static_unload()` method is called on the GDScript. If the custom function `_static_init()` exists it will be called when the class is loaded, after the static variables are set.
* GDScript: Use default path in test generator if not providedGeorge Marques2023-04-261-5/+5
| | | | | Since it's almost always used with the same path, assume it is running from the Godot source root.
* GDScript: Add warnings that are set to error by defaultGeorge Marques2023-02-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* Revert "GDScript: Add warnings that are set to error by default"Rémi Verschelde2023-02-011-3/+3
| | | | | | | | | This reverts commit a166833bfa23a21a7bff196a85a20b014e7c1396. This caused multiple regressions. Needs to be redone with more testing before merge. Fixes #72501.
* GDScript: Add warnings that are set to error by defaultGeorge Marques2023-02-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* Add option to print filenames in GDScript unit testingocean (they/them)2023-01-301-16/+16
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | 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".
* Fix singleton scene cyclic loadingAdam Scott2022-11-251-15/+26
|
* Fix cyclic references in GDScript 2.0Adam Scott2022-11-181-1/+7
|
* GDScript compiler subclass bugfixesRune2022-11-131-1/+0
|
* Fix more MSVC C4702 (unreachable code) warningsRémi Verschelde2022-10-071-6/+6
|
* Rename String `plus_file` to `path_join`Aaron Franke2022-08-291-3/+3
|
* Variant memory poolslawnjelly2022-07-041-2/+3
| | | | Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
* Adding print_rich for printing with BBCodeVoylin2022-06-291-1/+1
|
* 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>