summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests
AgeCommit message (Collapse)Author
2022-07-25Code quality: Fix header guards consistencyRémi Verschelde
Adds `header_guards.sh` bash script, used in CI to validate future changes. Can be run locally to fix invalid header guards.
2022-07-06Merge pull request #62701 from cdemirer/for-variable-conflictRémi Verschelde
2022-07-05Add grouping annotations for class properties in GDScriptYuri Sizov
2022-07-04Do error when for variable conflicts with a variable in scopecdemirer
2022-06-28Merge pull request #60675 from voylin/Add-BBCode-support-for-printing-outputRémi Verschelde
Adding print_rich() for printing with BBCode
2022-06-28Fix set chain bug with jump_if_sharedcdemirer
2022-06-29Adding print_rich for printing with BBCodeVoylin
2022-06-15Merge pull request #59358 from strank/debug-inner-classesGeorge Marques
2022-06-15Merge pull request #61666 from nathanfranke/fix-match-bindGeorge Marques
gdscript: use correct error for unused bind match, suppress with underscore
2022-06-14Merge pull request #57151 from cdemirer/fix-match-array-dict-pattern-logic-errorGeorge Marques
Fix logic errors in match-statement Array & Dictionary patterns
2022-06-12Extend test_compiler to also disassemble inner classesstrank
2022-06-03use correct error for unused bind match, suppress with underscoreNathan Franke
2022-05-31Merge pull request #61440 from vnen/gdscript-scene-unique-nodesRémi Verschelde
GDScript: Support `%` in shorthand for `get_node`
2022-05-27GDScript: Support `%` in shorthand for `get_node`George Marques
The `%` is used in scene unique nodes. Now `%` can also be used instead of `$` for the shorthand, besides being allowed generally anywhere in the path as the prefix for a node name.
2022-05-25Merge pull request #61279 from Trioct/fix-typed-array-assignmentRémi Verschelde
2022-05-25Fix const typed array assignmentTrioct
2022-05-24GDScript: Don't show redundant await warning on unknown typesGeorge Marques
Also avoid it when the type is known to be a signal.
2022-05-23GDScript: Fix lambda captures in default argument valuesGeorge Marques
2022-05-23GDScript: Fix `if` after lambda being seen as ternaryGeorge Marques
2022-05-23GDScript: Do not allow standalone lambdasGeorge Marques
They cannot be accessed in this case, so an error is shown to avoid misleading the uses, especially in case of named lambdas.
2022-05-18Merge pull request #55201 from Scony/fix-unreachable-code-false-positiveRémi Verschelde
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-11Merge pull request #59863 from cdemirer/fix-match-multiple-bind-single-patternRémi Verschelde
Fix issues with multiple bind patterns in match statement
2022-05-11Merge pull request #60732 from CalebJohn/matching_signature_regression_testRémi Verschelde
2022-05-03Add regression test for gdscript valid function signatureCalebJohn
Previously, there was an issue where the gdscript analyzer incorrectly riased a validation error for code that had a default Dictionary, Array, or custom type.
2022-05-03quote strings inside arrays and dictionariesNathan Franke
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-27Merge pull request #60396 from vnen/gdscript-self-lambdaRémi Verschelde
2022-04-24GDScript: Allow using self in lambdasGeorge Marques
2022-04-19Fixes GDScript define nested dictionary and array as constants #50285PastMoments
2022-04-11Make FileAccess and DirAccess classes reference counted.bruvzg
2022-04-04Merge pull request #59885 from Jayman2000/autoload-inheritance-messageRémi Verschelde
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-04-04Zero initialize all pointer class and struct membersRémi Verschelde
This prevents the pitfall of UB when checking if they have been assigned something valid by comparing to nullptr.
2022-04-04Fix issues with multiple bind patterns in match statementcdemirer
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-03-06GDScript: Check if method signature matches the parentGeorge Marques
To guarantee polymorphism, a method signature must be compatible with the parent. This checks if: 1. Return type is the same. 2. The subclass method takes at least the same amount of parameters. 3. The matching parameters have the same type. 4. If the subclass takes more parameters, all of the extra ones have a default value. 5. If the superclass has default values, so must have the subclass. There's a few test cases to ensure this holds up.
2022-03-04Add test cases for accessing parent elements from child classstrank
2022-03-02Fix logic errors in match-statement Array & Dictionary Patternscdemirer
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-04Merge pull request #57591 from vnen/gdscript-enum-fixesRémi Verschelde
2022-02-03GDScript: Treat enum values as int and enum types as dictionaryGeorge Marques
Since enums resolve to a dictionary at runtime, calling dictionary methods on an enum type is a valid use case. This ensures this is true by adding test cases. This also makes enum values be treated as ints when used in operations.
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-02-03GDScript: Consolidate behavior for assigning enum typesGeorge Marques
This makes sure that assigning values to enum-typed variables are consistent. Same enum is always valid, different enum is always invalid (without casting) and assigning `int` creates a warning if there is no casting. There are new test cases to ensure this behavior doesn't break in the future.
2022-01-23Merge pull request #57052 from KoBeWi/nosortRémi Verschelde
2022-01-22Merge pull request #55214 from Scony/fix-gdscript-crash-2Rémi Verschelde
Fix GDScript parser crash on 'dollar mixed with assignment' expression
2022-01-22Don't sort printed Dictionarykobewi
2022-01-13GDScript: Fix parsing default parameter values from function callsstrank
2022-01-06Fix multiple missing UTF-8 decoding.bruvzg