Theseus
Theseus copied to clipboard
Add tests for async_channel
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
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?
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.