xref: /llvm-project/libcxx/test/std/input.output/iostream.format/std.manip/setfill_wchar_max.pass.cpp (revision 4a2a1b51cb6b88820e28019040fb78d0c82685ab)
1194f98c2SXing Xue //===----------------------------------------------------------------------===//
2194f98c2SXing Xue //
3194f98c2SXing Xue // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4194f98c2SXing Xue // See https://llvm.org/LICENSE.txt for license information.
5194f98c2SXing Xue // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6194f98c2SXing Xue //
7194f98c2SXing Xue //===----------------------------------------------------------------------===//
8194f98c2SXing Xue 
9194f98c2SXing Xue // Test that WCHAR_MAX as a wchar_t value can be set as the fill character.
10194f98c2SXing Xue 
11194f98c2SXing Xue // UNSUPPORTED: no-wide-characters
12194f98c2SXing Xue 
13194f98c2SXing Xue // Expect the test case to fail on targets where WEOF is the same as
14194f98c2SXing Xue // WCHAR_MAX with the libcpp ABI version 1 implementation. The libcpp ABI
15194f98c2SXing Xue // version 2 implementation fixes the problem.
16194f98c2SXing Xue 
17194f98c2SXing Xue // XFAIL: target={{.*}}-windows{{.*}} && libcpp-abi-version=1
18*4a2a1b51SVladimir Vereschaka // XFAIL: target=armv{{7|8}}{{l?}}{{.*}}-linux-gnueabihf && libcpp-abi-version=1
19ad154281SDavid Tenty // XFAIL: target=aarch64{{.*}}-linux-gnu && libcpp-abi-version=1
20194f98c2SXing Xue 
21194f98c2SXing Xue #include <iomanip>
22194f98c2SXing Xue #include <ostream>
23194f98c2SXing Xue #include <cassert>
24194f98c2SXing Xue #include <string>
25194f98c2SXing Xue 
26194f98c2SXing Xue template <class CharT>
27194f98c2SXing Xue struct testbuf : public std::basic_streambuf<CharT> {
28194f98c2SXing Xue   testbuf() {}
29194f98c2SXing Xue };
30194f98c2SXing Xue 
31194f98c2SXing Xue int main(int, char**) {
32194f98c2SXing Xue   testbuf<wchar_t> sb;
33194f98c2SXing Xue   std::wostream os(&sb);
34194f98c2SXing Xue   os << std::setfill((wchar_t)WCHAR_MAX);
35194f98c2SXing Xue   assert(os.fill() == (wchar_t)WCHAR_MAX);
36194f98c2SXing Xue 
37194f98c2SXing Xue   return 0;
38194f98c2SXing Xue }
39