Theseus icon indicating copy to clipboard operation
Theseus copied to clipboard

Add tests for async_channel

Open amab8901 opened this issue 2 years ago • 2 comments

addresses 3rd checkbox in https://github.com/theseus-os/Theseus/issues/715

Let me know if I did it correctly and if there's anything missing

amab8901 avatar Feb 12 '23 05:02 amab8901

Thanks! The initial set of tests is decent, but there are a few more scenarios that ought to be tested. The major issue is that the sending and receiving tasks are the same -- for a real test, the sending ought to be done on a different task from the receiving.

How can I tell whether the sending and receiving tasks are the same?

amab8901 avatar Feb 15 '23 07:02 amab8901

How can I tell whether the sending and receiving tasks are the same?

Just like with regular Rust, unless you manually spawned a new task, all of your code in a function or within a series of functions that call each other will all run in the same task. Here I'm suggesting that you create a test scenario that is more representative of real-world channel usage, in that the sender(s) and receiver(s) are typically on different tasks, as it doesn't make much sense for a task to send itself a message via a channel.

kevinaboos avatar Feb 15 '23 22:02 kevinaboos