MCPcopy Create free account
hub / github.com/3rdparty/libprocess / TEST

Function TEST

src/tests/http_tests.cpp:547–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545
546
547TEST(HTTPTest, PipeReadAll)
548{
549 {
550 http::Pipe pipe;
551 http::Pipe::Reader reader = pipe.reader();
552 http::Pipe::Writer writer = pipe.writer();
553
554 Future<string> readAll = reader.readAll();
555 EXPECT_TRUE(readAll.isPending());
556
557 // Close the writer after writing some data. This should result in
558 // a successful `readAll()` operation.
559 EXPECT_TRUE(writer.write("hello"));
560 EXPECT_TRUE(writer.write("world"));
561
562 EXPECT_TRUE(writer.close());
563
564 AWAIT_EXPECT_EQ("helloworld", readAll);
565 }
566
567 {
568 http::Pipe pipe;
569 http::Pipe::Reader reader = pipe.reader();
570 http::Pipe::Writer writer = pipe.writer();
571
572 Future<string> readAll = reader.readAll();
573 EXPECT_TRUE(readAll.isPending());
574
575 // Fail the writer after writing some data. This should result in
576 // a failed `readAll()` operation.
577 EXPECT_TRUE(writer.write("hello"));
578 EXPECT_TRUE(writer.write("world"));
579
580 EXPECT_TRUE(writer.fail("disconnected!"));
581
582 AWAIT_EXPECT_FAILED(readAll);
583 }
584}
585
586
587TEST_P(HTTPTest, PipeReaderCloses)

Callers

nothing calls this directly

Calls 15

URLClass · 0.85
getFunction · 0.85
OKClass · 0.85
FutureSatisfyFunction · 0.85
AddressClass · 0.85
readerMethod · 0.80
writerMethod · 0.80
readAllMethod · 0.80
isPendingMethod · 0.80
writeMethod · 0.80
selfMethod · 0.80
futureMethod · 0.80

Tested by

no test coverage detected