| 171 | |
| 172 | template<class T> |
| 173 | void |
| 174 | testParseIntoErrors( error e, value const& sample ) |
| 175 | { |
| 176 | #if defined(__GNUC__) && __GNUC__ < 5 |
| 177 | # pragma GCC diagnostic push |
| 178 | # pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
| 179 | #endif |
| 180 | system::error_code ec; |
| 181 | T t1{}; |
| 182 | std::string json = serialize(sample); |
| 183 | |
| 184 | parse_into<T>(t1, json, ec); |
| 185 | BOOST_TEST( ec.failed() ); |
| 186 | BOOST_TEST( ec.has_location() ); |
| 187 | BOOST_TEST( ec == e ); |
| 188 | |
| 189 | T t2{}; |
| 190 | ec = {}; |
| 191 | parser_for<T> p( parse_options{}, &t2 ); |
| 192 | for( auto& c: json ) |
| 193 | { |
| 194 | std::size_t const n = p.write_some( true, &c, 1, ec ); |
| 195 | if( ec.failed() ) |
| 196 | break; |
| 197 | BOOST_TEST( n == 1 ); |
| 198 | } |
| 199 | if( !ec.failed() ) |
| 200 | p.write_some(false, nullptr, 0, ec); |
| 201 | |
| 202 | BOOST_TEST( ec.failed() ); |
| 203 | BOOST_TEST( ec.has_location() ); |
| 204 | BOOST_TEST( ec == e ); |
| 205 | #if defined(__GNUC__) && __GNUC__ < 5 |
| 206 | # pragma GCC diagnostic pop |
| 207 | #endif |
| 208 | } |
| 209 | |
| 210 | void testNull() |
| 211 | { |
nothing calls this directly
no test coverage detected