1139826Simp// { dg-options "-std=gnu++17" } 252904Sshin 352904Sshin// Copyright (C) 2013-2020 Free Software Foundation, Inc. 453541Sshin// 552904Sshin// This file is part of the GNU ISO C++ Library. This library is free 652904Sshin// software; you can redistribute it and/or modify it under the 752904Sshin// terms of the GNU General Public License as published by the 852904Sshin// Free Software Foundation; either version 3, or (at your option) 952904Sshin// any later version. 1052904Sshin 1152904Sshin// This library is distributed in the hope that it will be useful, 1252904Sshin// but WITHOUT ANY WARRANTY; without even the implied warranty of 1352904Sshin// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1452904Sshin// GNU General Public License for more details. 1552904Sshin 1653541Sshin// You should have received a copy of the GNU General Public License along 1752904Sshin// with this library; see the file COPYING3. If not see 1852904Sshin// <http://www.gnu.org/licenses/>. 1952904Sshin 2052904Sshin// inserters 2152904Sshin 2252904Sshin// NB: This file is predicated on sstreams, istreams, and ostreams 2352904Sshin// working, not to mention other major details like char_traits, and 2452904Sshin// all of the string_view class. 2552904Sshin 2652904Sshin#include <string_view> 2752904Sshin#include <stdexcept> 28174510Sobrien#include <sstream> 29174510Sobrien#include <fstream> 3052904Sshin#include <iostream> 3152904Sshin#include <testsuite_hooks.h> 32139826Simp 3352904Sshinvoid 3452904Sshintest01() 3552904Sshin{ 3652904Sshin typedef std::string_view::size_type csize_type; 3752904Sshin typedef std::string_view::const_reference cref; 3852904Sshin typedef std::string_view::reference ref; 3952904Sshin 4052904Sshin const std::string_view str01("sailing grand traverse bay\n" 4152904Sshin "\t\t\t from Elk Rapids to the point reminds me of miles"); 4252904Sshin 4352904Sshin // ostream& operator<<(ostream&, const basic_string_view&) 4452904Sshin std::ostringstream ostrs01; 4552904Sshin try 4652904Sshin { 4752904Sshin ostrs01 << str01; 4852904Sshin VERIFY( ostrs01.str() == str01 ); 4952904Sshin } 5052904Sshin catch(std::exception& fail) 5152904Sshin { 5252904Sshin VERIFY( false ); 5352904Sshin } 5452904Sshin 5552904Sshin std::string_view hello_world; 5652904Sshin std::cout << hello_world; 5752904Sshin} 5852904Sshin 5952904Sshinint 6052904Sshinmain() 61174510Sobrien{ 6252904Sshin test01(); 6352904Sshin 6462587Sitojun return 0; 6578064Sume} 6657120Sshin