Fix SCRIPT ERROR/ERROR/WARNING on test output

Also "fixing" some GDScript completion tests which
where named wrongly.
This commit is contained in:
Pablo Andres Fuente 2025-03-06 00:40:35 +01:00
parent 134da37497
commit 5775d29ad8
33 changed files with 30 additions and 13 deletions

View file

@ -1,3 +1,5 @@
extends Node
@onready var anim := $AnimationPlayer @onready var anim := $AnimationPlayer
func test(): func test():

View file

@ -1,3 +1,5 @@
extends Node
@onready var anim: AnimationPlayer = $AnimationPlayer @onready var anim: AnimationPlayer = $AnimationPlayer
func test(): func test():

View file

@ -1,3 +1,5 @@
extends Node
@onready var anim = $AnimationPlayer @onready var anim = $AnimationPlayer
func test(): func test():

View file

@ -1,5 +1,5 @@
extends Node extends Node
func a(): func a():
%AnimationPlayer. $UniqueAnimationPlayer.
pass pass

View file

@ -1,5 +1,5 @@
extends Node extends Node
func a(): func a():
$UniqueAnimationPlayer. %AnimationPlayer.
pass pass

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test := $AnimationPlayer @onready var test := $AnimationPlayer
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test = $A @onready var test = $A
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test = $AnimationPlayer @onready var test = $AnimationPlayer
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test: AnimationPlayer = $AnimationPlayer @onready var test: AnimationPlayer = $AnimationPlayer
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test: Node = $A @onready var test: Node = $A
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test: Node = $AnimationPlayer @onready var test: Node = $AnimationPlayer
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test: Area2D = $A @onready var test: Area2D = $A
func a(): func a():
test. test.

View file

@ -1,6 +1,6 @@
extends Node extends Node
var test: Area2D = $AnimationPlayer @onready var test: Area2D = $AnimationPlayer
func a(): func a():
test. test.

View file

@ -161,6 +161,8 @@ static void test_directory(const String &p_dir) {
owner = scene->get_node(conf.get_value("input", "node_path", ".")); owner = scene->get_node(conf.get_value("input", "node_path", "."));
} }
// The only requirement is for the script to be parsable, warnings and errors from the analyzer might happen and completion should still work.
ERR_PRINT_OFF;
if (owner != nullptr) { if (owner != nullptr) {
// Remove the line which contains the sentinel char, to get a valid script. // Remove the line which contains the sentinel char, to get a valid script.
Ref<GDScript> scr; Ref<GDScript> scr;
@ -184,6 +186,8 @@ static void test_directory(const String &p_dir) {
} }
GDScriptLanguage::get_singleton()->complete_code(code, res_path, owner, &options, forced, call_hint); GDScriptLanguage::get_singleton()->complete_code(code, res_path, owner, &options, forced, call_hint);
ERR_PRINT_ON;
String contains_excluded; String contains_excluded;
for (ScriptLanguage::CodeCompletionOption &option : options) { for (ScriptLanguage::CodeCompletionOption &option : options) {
for (const Dictionary &E : exclude) { for (const Dictionary &E : exclude) {

View file

@ -235,9 +235,13 @@ TEST_CASE("[AHashMap] Insert, iterate and remove many elements") {
TEST_CASE("[AHashMap] Insert, iterate and remove many strings") { TEST_CASE("[AHashMap] Insert, iterate and remove many strings") {
const int elem_max = 432; const int elem_max = 432;
AHashMap<String, String> map; AHashMap<String, String> map;
// To not print WARNING: Excessive collision count (NN), is the right hash function being used?
ERR_PRINT_OFF;
for (int i = 0; i < elem_max; i++) { for (int i = 0; i < elem_max; i++) {
map.insert(itos(i), itos(i)); map.insert(itos(i), itos(i));
} }
ERR_PRINT_ON;
//insert order should have been kept //insert order should have been kept
int idx = 0; int idx = 0;

View file

@ -4492,7 +4492,8 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
Point2 caret_pos = code_edit->get_caret_draw_pos(); Point2 caret_pos = code_edit->get_caret_draw_pos();
caret_pos.x += 60; caret_pos.x += 60;
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::NONE, 0, Key::NONE);
SEND_GUI_MOUSE_MOTION_EVENT(caret_pos, MouseButtonMask::NONE, Key::NONE);
CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text"); CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text");
SIGNAL_WATCH(code_edit, "symbol_validate"); SIGNAL_WATCH(code_edit, "symbol_validate");

View file

@ -8014,6 +8014,8 @@ TEST_CASE("[SceneTree][TextEdit] gutters") {
SIGNAL_WATCH(text_edit, "gutter_removed"); SIGNAL_WATCH(text_edit, "gutter_removed");
SUBCASE("[TextEdit] gutter add and remove") { SUBCASE("[TextEdit] gutter add and remove") {
text_edit->set_text("test1\ntest2\ntest3\ntest4");
text_edit->add_gutter(); text_edit->add_gutter();
CHECK(text_edit->get_gutter_count() == 1); CHECK(text_edit->get_gutter_count() == 1);
CHECK(text_edit->get_gutter_width(0) == 24); CHECK(text_edit->get_gutter_width(0) == 24);

View file

@ -306,7 +306,7 @@ struct GodotTestCaseListener : public doctest::IReporter {
// So we have to do this for each test case. Also make sure there is // So we have to do this for each test case. Also make sure there is
// no residual theme from something else. // no residual theme from something else.
ThemeDB::get_singleton()->finalize_theme(); ThemeDB::get_singleton()->finalize_theme();
ThemeDB::get_singleton()->initialize_theme_noproject(); ThemeDB::get_singleton()->initialize_theme();
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server(); physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server();