1 //===----------------------------------------------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 // XFAIL: libcpp-has-no-stdin 10 11 // <iostream> 12 13 // istream cin; 14 15 // FILE_DEPENDENCIES: %t.exe 16 // RUN: %{build} 17 // RUN: %{exec} echo "123" \| %t.exe > %t.out 18 // RUN: grep -e 'The number is 123!' %t.out 19 20 #include <iostream> 21 #include <cassert> 22 23 #include "test_macros.h" 24 25 int main(int, char**) 26 { 27 int i; 28 std::cin >> i; 29 std::cout << "The number is " << i << "!"; 30 31 #ifdef _LIBCPP_HAS_NO_STDOUT 32 assert(std::cin.tie() == NULL); 33 #else 34 assert(std::cin.tie() == &std::cout); 35 #endif 36 37 return 0; 38 } 39