]>
Commit | Line | Data |
---|---|---|
445877a9 | 1 | // Copyright (C) 2003, 2009, 2010 Free Software Foundation |
52a16d08 PC |
2 | // |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
748086b7 | 6 | // Free Software Foundation; either version 3, or (at your option) |
52a16d08 PC |
7 | // any later version. |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
15 | // with this library; see the file COPYING3. If not see |
16 | // <http://www.gnu.org/licenses/>. | |
52a16d08 PC |
17 | |
18 | // 22.2.5.3.1 time_put members | |
19 | ||
20 | #include <locale> | |
21 | #include <sstream> | |
22 | #include <ctime> | |
23 | #include <cstring> | |
24 | #include <testsuite_hooks.h> | |
25 | ||
26 | class TP : public std::time_put<wchar_t> | |
27 | { | |
28 | public: | |
29 | mutable std::wstring fill_chars; | |
30 | ||
31 | protected: | |
32 | iter_type do_put(iter_type s, std::ios_base&, char_type fill, | |
8b5bc374 | 33 | const std::tm*, char, char) const |
52a16d08 PC |
34 | { |
35 | fill_chars.push_back(fill); | |
36 | return s; | |
37 | } | |
38 | }; | |
39 | ||
40 | // libstdc++/12439 | |
41 | // time_put::put doesn't pass fill character to do_put | |
42 | void test01() | |
43 | { | |
44 | using namespace std; | |
45 | bool test __attribute__((unused)) = true; | |
46 | ||
47 | wostringstream stream; | |
445877a9 | 48 | time_t tt = time(0); |
52a16d08 PC |
49 | |
50 | const wchar_t* fmt = L"%c"; | |
51 | ||
52 | TP tp; | |
53 | tp.put(TP::iter_type(stream), stream, L'W', localtime(&tt), | |
54 | fmt, fmt + wcslen(fmt)); | |
55 | VERIFY( !tp.fill_chars.empty() ); | |
56 | VERIFY( tp.fill_chars[tp.fill_chars.length() - 1] == L'W' ); | |
57 | } | |
58 | ||
59 | int main() | |
60 | { | |
61 | test01(); | |
62 | return 0; | |
63 | } |