| 1187 | } |
| 1188 | |
| 1189 | void test_streambuf_async_read_until_string() |
| 1190 | { |
| 1191 | #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) |
| 1192 | namespace bindns = std; |
| 1193 | using bindns::placeholders::_1; |
| 1194 | using bindns::placeholders::_2; |
| 1195 | |
| 1196 | boost::asio::io_context ioc; |
| 1197 | test_stream s(ioc); |
| 1198 | boost::asio::streambuf sb1; |
| 1199 | boost::asio::streambuf sb2(25); |
| 1200 | boost::system::error_code ec; |
| 1201 | std::size_t length; |
| 1202 | bool called; |
| 1203 | |
| 1204 | s.reset(read_data, sizeof(read_data)); |
| 1205 | ec = boost::system::error_code(); |
| 1206 | length = 0; |
| 1207 | called = false; |
| 1208 | sb1.consume(sb1.size()); |
| 1209 | boost::asio::async_read_until(s, sb1, "XYZ", |
| 1210 | bindns::bind(async_read_handler, _1, &ec, |
| 1211 | _2, &length, &called)); |
| 1212 | ioc.restart(); |
| 1213 | ioc.run(); |
| 1214 | BOOST_ASIO_CHECK(called); |
| 1215 | BOOST_ASIO_CHECK(!ec); |
| 1216 | BOOST_ASIO_CHECK(length == 26); |
| 1217 | |
| 1218 | s.reset(read_data, sizeof(read_data)); |
| 1219 | s.next_read_length(1); |
| 1220 | ec = boost::system::error_code(); |
| 1221 | length = 0; |
| 1222 | called = false; |
| 1223 | sb1.consume(sb1.size()); |
| 1224 | boost::asio::async_read_until(s, sb1, "XYZ", |
| 1225 | bindns::bind(async_read_handler, _1, &ec, |
| 1226 | _2, &length, &called)); |
| 1227 | ioc.restart(); |
| 1228 | ioc.run(); |
| 1229 | BOOST_ASIO_CHECK(called); |
| 1230 | BOOST_ASIO_CHECK(!ec); |
| 1231 | BOOST_ASIO_CHECK(length == 26); |
| 1232 | |
| 1233 | s.reset(read_data, sizeof(read_data)); |
| 1234 | s.next_read_length(10); |
| 1235 | ec = boost::system::error_code(); |
| 1236 | length = 0; |
| 1237 | called = false; |
| 1238 | sb1.consume(sb1.size()); |
| 1239 | boost::asio::async_read_until(s, sb1, "XYZ", |
| 1240 | bindns::bind(async_read_handler, _1, &ec, |
| 1241 | _2, &length, &called)); |
| 1242 | ioc.restart(); |
| 1243 | ioc.run(); |
| 1244 | BOOST_ASIO_CHECK(called); |
| 1245 | BOOST_ASIO_CHECK(!ec); |
| 1246 | BOOST_ASIO_CHECK(length == 26); |
nothing calls this directly
no test coverage detected