1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
13 // basic_istream<charT,traits>&
14 // ignore(streamsize n = 1, int_type delim = traits::eof());
19 #include "test_macros.h"
21 template <class CharT
>
23 : public std::basic_streambuf
<CharT
>
25 typedef std::basic_string
<CharT
> string_type
;
26 typedef std::basic_streambuf
<CharT
> base
;
32 testbuf(const string_type
& str
)
35 base::setg(const_cast<CharT
*>(str_
.data()),
36 const_cast<CharT
*>(str_
.data()),
37 const_cast<CharT
*>(str_
.data()) + str_
.size());
40 CharT
* eback() const {return base::eback();}
41 CharT
* gptr() const {return base::gptr();}
42 CharT
* egptr() const {return base::egptr();}
48 testbuf
<char> sb(" 1\n2345\n6");
53 assert(is
.gcount() == 1);
57 assert(is
.gcount() == 2);
61 assert(is
.gcount() == 6);
63 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
65 testbuf
<wchar_t> sb(L
" 1\n2345\n6");
66 std::wistream
is(&sb
);
70 assert(is
.gcount() == 1);
74 assert(is
.gcount() == 2);
78 assert(is
.gcount() == 6);
81 #ifndef TEST_HAS_NO_EXCEPTIONS
83 testbuf
<char> sb(" ");
84 std::basic_istream
<char> is(&sb
);
85 is
.exceptions(std::ios_base::eofbit
);
89 } catch (std::ios_base::failure
&) {
97 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
99 testbuf
<wchar_t> sb(L
" ");
100 std::basic_istream
<wchar_t> is(&sb
);
101 is
.exceptions(std::ios_base::eofbit
);
105 } catch (std::ios_base::failure
&) {
114 #endif // TEST_HAS_NO_EXCEPTIONS