1 //===----------------------------------------------------------------------===// 2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 3 // See https://llvm.org/LICENSE.txt for license information. 4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 5 // 6 //===----------------------------------------------------------------------===// 7 8 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 9 // UNSUPPORTED: executor-has-no-bash 10 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME 11 12 // XFAIL: availability-fp_to_chars-missing 13 14 // <print> 15 16 // void vprint_nonunicode(string_view fmt, format_args args); 17 18 // Testing this properly is quite hard; the function unconditionally 19 // writes to stdout. When stdout is redirected to a file it is no longer 20 // considered a terminal. The function is a small wrapper around 21 // 22 // void vprint_nonunicode(FILE* stream, string_view fmt, format_args args); 23 // 24 // So do minimal tests for this function and rely on the FILE* overload 25 // to do more testing. 26 // 27 // The testing is based on the testing for std::cout. 28 29 // TODO PRINT Use lit builtin echo 30 31 // FILE_DEPENDENCIES: echo.sh 32 // RUN: %{build} 33 // RUN: %{exec} bash echo.sh -n "1234 一二三四 true 0x0" > %t.expected 34 // RUN: %{exec} "%t.exe" > %t.actual 35 // RUN: diff -u %t.actual %t.expected 36 37 #include <print> 38 39 int main(int, char**) { 40 // The data is passed as-is so it does not depend on the encoding of the input. 41 std::vprint_nonunicode("{} {} ", std::make_format_args(1234, "一二三四")); 42 std::vprint_nonunicode("{} {}", std::make_format_args(true, nullptr)); 43 44 return 0; 45 } 46