Add unit tests for StreamPeerTCP#102064
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Oct 23, 2025
Merged
Conversation
pafuent
reviewed
Mar 5, 2025
pafuent
reviewed
Mar 5, 2025
a4a8762 to
2b51b82
Compare
99 tasks
Calinou
requested changes
Sep 19, 2025
Member
Calinou
left a comment
There was a problem hiding this comment.
Tested locally on Linux (rebased on top of master 9dde568), I get a build error:
In file included from tests/test_main.cpp:63:
./tests/core/io/test_stream_peer_tcp.h: In function 'void TestStreamPeerTCP::DOCTEST_ANON_FUNC_880()':
./tests/core/io/test_stream_peer_tcp.h:264:27: error: 'class Vector<unsigned char>' has no member named 'resize_zeroed'
264 | send_data.resize_zeroed(expected.length());
| ^~~~~~~~~~~~~
In file included from ./core/variant/binder_common.h:34,
from ./core/object/method_bind.h:33,
from ./core/object/class_db.h:33,
from ./core/object/ref_counted.h:33,
from ./core/io/dir_access.h:33,
from tests/test_main.cpp:34:
./core/object/object.h: In instantiation of 'static T* Object::cast_to(Object*) [with T = NetSocket]':
./core/object/ref_counted.h:145:40: required from 'void Ref<T>::operator=(const Ref<T_Other>&) [with T_Other = TestStreamPeerTCP::MockNetSocket; T = NetSocket]'
145 | ref_pointer<false>(Object::cast_to<T>(p_from.ptr()));
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
./core/object/ref_counted.h:182:18: required from 'Ref<T>::Ref(const Ref<T_Other>&) [with T_Other = TestStreamPeerTCP::MockNetSocket; T = NetSocket]'
182 | this->operator=(p_from);
| ~~~~~~~~~~~~~~~^~~~~~~~
./tests/core/io/test_stream_peer_tcp.h:192:21: required from here
192 | spt->accept_socket(ns, peer_ip, peer_port);
| ^~
./core/object/object.h:799:36: error: static assertion failed: T must use GDCLASS or GDSOFTCLASS
799 | static_assert(std::is_same_v<std::decay_t<T>, typename T::self_type>, "T must use GDCLASS or GDSOFTCLASS");
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./core/object/object.h:799:36: note: 'std::is_same_v<NetSocket, RefCounted>' evaluates to false
scons: *** [bin/obj/tests/test_main.linuxbsd.editor.x86_64.o] Error 1
scons: building terminated because of errors.
Calinou
reviewed
Sep 19, 2025
2100467 to
6ca1c88
Compare
6ca1c88 to
cdbe75e
Compare
This was referenced Sep 19, 2025
wheatear-dev
commented
Sep 19, 2025
f211d1d to
189c773
Compare
Calinou
approved these changes
Sep 23, 2025
Member
Calinou
left a comment
There was a problem hiding this comment.
Works great now 🙂 Code looks good to me.
AThousandShips
approved these changes
Sep 25, 2025
e3f525a to
bc83ad4
Compare
AThousandShips
approved these changes
Sep 27, 2025
Contributor
|
Needs a rebase; several TCP functions have been updated, so |
bc83ad4 to
b694fe6
Compare
Contributor
Author
Hi @Repiteo I have rebased, and ported over to the new code for But this doesn't appear to be emitted from one of my test cases: |
Repiteo
approved these changes
Oct 23, 2025
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds unit tests for
StreamPeerTCP, using a mock implementation ofNetSocket(#43440).Includes:
FINmessage)StreamPeerTCP::put_data()StreamPeerTCP::get_data()Several public methods on
StreamPeerTCPare tested, but more remain untested - this can be addressed in later PR's if required.Thanks! 😌