tokio icon indicating copy to clipboard operation
tokio copied to clipboard

(WIP): Adding Stream mock to tokio-test

Open Grubba27 opened this issue 3 years ago • 4 comments

Motivation

This issue relates to #4106

Solution

Test the Stream with the mock as sugested in issue thread

This is a draft. I got stuck creating the solution, created this PR in hope that I could get some help

Grubba27 avatar Feb 02 '22 21:02 Grubba27

Let me know if there's any other help you need.

Sure! I'm trying to get to know Tokio code base and its patterns. Should I create also a file just for io_stream ? also I'm not sure how I would implement stream in Mock and how I would test it if not by let val = stream.next().await as stream here would be building mock as stream ? like in the return of mock -> impl Stream<value = &str>

Grubba27 avatar Feb 08 '22 01:02 Grubba27

also I'm not sure how I would implement stream in Mock and how I would test it if not by let val = stream.next().await as stream here would be building mock as stream

You would test it by calling next on the Mock value as you suggested.

Darksonn avatar Feb 08 '22 07:02 Darksonn

Sorry, this PR appears to have gotten lost. Do you want to finish it? There are some CI failures.

Darksonn avatar Jun 30 '22 09:06 Darksonn

Sorry, this PR appears to have gotten lost. Do you want to finish it? There are some CI failures.

Yeah, I Would love to finish. It has been some time since I haven't touched Rust but I can give it another try again guess this last note can help me :

I don't have any ideia why my mock.next.await is aways returning None for me. perhaps because of the cx ? Maybe I should use a mock Context too for using pool_next(cx) ? or keep with next() but change the way that I call Action it at io_steram ?

Grubba27 avatar Jun 30 '22 14:06 Grubba27

Hey, I'm really sorry that this got lost. Do you still want to work on it? If not, that's ok.

Darksonn avatar Apr 16 '23 14:04 Darksonn

This has been superseded by #5915.

Darksonn avatar Nov 25 '23 12:11 Darksonn