15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <string>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // template<class charT, class traits, class Allocator>
125a83710eSEric Fiselier //   basic_istream<charT,traits>&
135a83710eSEric Fiselier //   getline(basic_istream<charT,traits>&& is,
145a83710eSEric Fiselier //           basic_string<charT,traits,Allocator>& str);
155a83710eSEric Fiselier 
165a83710eSEric Fiselier #include <string>
175a83710eSEric Fiselier #include <sstream>
185a83710eSEric Fiselier #include <cassert>
195a83710eSEric Fiselier 
207fc6a556SMarshall Clow #include "test_macros.h"
215a83710eSEric Fiselier #include "min_allocator.h"
225a83710eSEric Fiselier 
main(int,char **)232df59c50SJF Bastien int main(int, char**)
245a83710eSEric Fiselier {
255a83710eSEric Fiselier     {
265a83710eSEric Fiselier         std::string s("initial text");
27*98bb747cSArthur O'Dwyer         std::getline(std::istringstream(" abc\n  def\n   ghij"), s);
285a83710eSEric Fiselier         assert(s == " abc");
295a83710eSEric Fiselier     }
30f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS
315a83710eSEric Fiselier     {
325a83710eSEric Fiselier         std::wstring s(L"initial text");
33*98bb747cSArthur O'Dwyer         std::getline(std::wistringstream(L" abc\n  def\n   ghij"), s);
345a83710eSEric Fiselier         assert(s == L" abc");
355a83710eSEric Fiselier     }
36f4c1258dSLouis Dionne #endif
375a83710eSEric Fiselier     {
385a83710eSEric Fiselier         typedef std::basic_string<char, std::char_traits<char>, min_allocator<char> > S;
395a83710eSEric Fiselier         S s("initial text");
40*98bb747cSArthur O'Dwyer         std::getline(std::istringstream(" abc\n  def\n   ghij"), s);
415a83710eSEric Fiselier         assert(s == " abc");
425a83710eSEric Fiselier     }
43f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS
445a83710eSEric Fiselier     {
455a83710eSEric Fiselier         typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, min_allocator<wchar_t> > S;
465a83710eSEric Fiselier         S s(L"initial text");
47*98bb747cSArthur O'Dwyer         std::getline(std::wistringstream(L" abc\n  def\n   ghij"), s);
485a83710eSEric Fiselier         assert(s == L" abc");
495a83710eSEric Fiselier     }
50f4c1258dSLouis Dionne #endif
512df59c50SJF Bastien 
522df59c50SJF Bastien   return 0;
535a83710eSEric Fiselier }
54