1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // XFAIL: with_system_cxx_lib=macosx10.7
14 // basic_istream<charT,traits>& get(char_type& c);
19 template <class CharT>
21 : public std::basic_streambuf<CharT>
23 typedef std::basic_string<CharT> string_type;
24 typedef std::basic_streambuf<CharT> base;
30 testbuf(const string_type& str)
33 base::setg(const_cast<CharT*>(str_.data()),
34 const_cast<CharT*>(str_.data()),
35 const_cast<CharT*>(str_.data()) + str_.size());
38 CharT* eback() const {return base::eback();}
39 CharT* gptr() const {return base::gptr();}
40 CharT* egptr() const {return base::egptr();}
46 testbuf<char> sb(" ");
53 assert(is.gcount() == 1);
56 testbuf<char> sb(" abc");
63 assert(is.gcount() == 1);
68 assert(is.gcount() == 1);
73 assert(is.gcount() == 1);
78 assert(is.gcount() == 1);
81 testbuf<wchar_t> sb(L" abc");
82 std::wistream is(&sb);
88 assert(is.gcount() == 1);
93 assert(is.gcount() == 1);
98 assert(is.gcount() == 1);
103 assert(is.gcount() == 1);