Files
clang-p2996/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin-wide-mode.sh.cpp
Louis Dionne 257eb74524 [libc++] Simplify how the global stream tests are written (#66842)
Instead of relying on Bash, use the builtin Lit commands whenever
possible. The motivation is to stop running %t.exe behind Bash, which
breaks on macOS 13.5 with SIP enabled because DYLD_LIBRARY_PATH isn't
forwarded to the underlying process when running through a protected
process.

For more details, see [1].

[1]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
2023-09-20 09:33:16 -04:00

35 lines
921 B
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <iostream>
// wistream wcin;
// UNSUPPORTED: no-wide-characters
// REQUIRES: target={{.+}}-windows-{{.+}}
// FILE_DEPENDENCIES: test.dat
// RUN: %{build}
// RUN: cat test.dat | %{exec} %t.exe
// Check that wcin works, preserving the unicode characters, after switching
// stdin to wide mode.
#include <iostream>
#include <cassert>
#include <io.h>
#include <fcntl.h>
int main(int, char**) {
_setmode(_fileno(stdin), _O_WTEXT);
std::wstring str;
std::wcin >> str;
assert(str == L"1234\u20ac\u00e5\u00e4\u00f6");
return 0;
}