xref: /llvm-project/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp (revision 98418c27bc17946990e5980d56ef98ae82da8770)
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 // QEMU does not detect EOF, when reading from stdin
10 // "echo -n" suppresses any characters after the output and so the test hangs.
11 // https://gitlab.com/qemu-project/qemu/-/issues/1963
12 // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
13 
14 // This test hangs on Android devices that lack shell_v2, which was added in
15 // Android N (API 24).
16 // UNSUPPORTED: LIBCXX-ANDROID-FIXME && android-device-api={{2[1-3]}}
17 
18 // <iostream>
19 
20 // istream cin;
21 
22 // RUN: %{build}
23 // RUN: echo -n 1234 > %t.input
24 // RUN: %{exec} %t.exe < %t.input
25 
26 #include <iostream>
27 #include <cassert>
28 
main(int,char **)29 int main(int, char**) {
30     int i;
31     std::cin >> i;
32     assert(i == 1234);
33     return 0;
34 }
35