| 1 | // (C) Copyright 2011 Steven Watanabe |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
| 4 | |
| 5 | // See http://www.boost.org/libs/iostreams for documentation. |
| 6 | |
| 7 | #include <fstream> |
| 8 | #include <boost/iostreams/filtering_stream.hpp> |
| 9 | #include <boost/test/test_tools.hpp> |
| 10 | #include "detail/sequence.hpp" |
| 11 | #include "detail/temp_file.hpp" |
| 12 | #include "detail/verification.hpp" |
| 13 | |
| 14 | void test_filtering_ostream_flush() |
| 15 | { |
| 16 | using namespace std; |
| 17 | using namespace boost; |
| 18 | using namespace boost::iostreams; |
| 19 | using namespace boost::iostreams::test; |
| 20 | |
| 21 | lowercase_file lower; |
| 22 | |
| 23 | { |
| 24 | temp_file dest; |
| 25 | filtering_ostream out; |
| 26 | out.push(t: tolower_filter()); |
| 27 | out.push(t: file_sink(dest.name(), out_mode)); |
| 28 | write_data_in_chars(os&: out); |
| 29 | out.flush(); |
| 30 | BOOST_CHECK_MESSAGE( |
| 31 | compare_files(dest.name(), lower.name()), |
| 32 | "failed writing to a filtering_ostream in chars with an " |
| 33 | "output filter" |
| 34 | ); |
| 35 | } |
| 36 | } |
| 37 |
