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 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 10 // UNSUPPORTED: no-filesystem 11 // UNSUPPORTED: executor-has-no-bash 12 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME 13 14 // FIXME PRINT How to test println on Windows? 15 // XFAIL: msvc, target={{.+}}-windows-gnu 16 17 // XFAIL: availability-fp_to_chars-missing 18 19 // <print> 20 21 // template<class... Args> 22 // void println(format_string<Args...> fmt, Args&&... args); 23 24 // Testing this properly is quite hard; the function unconditionally 25 // writes to stdout. When stdout is redirected to a file it is no longer 26 // considered a terminal. The function is a small wrapper around 27 // 28 // template<class... Args> 29 // void println(FILE* stream, format_string<Args...> fmt, Args&&... args); 30 // 31 // So do minimal tests for this function and rely on the FILE* overload 32 // to do more testing. 33 // 34 // The testing is based on the testing for std::cout. 35 36 // TODO PRINT Use lit builtin echo 37 38 // FILE_DEPENDENCIES: echo.sh 39 // RUN: %{build} 40 // RUN: %{exec} bash echo.sh -ne "1234 一二三四\ntrue 0x0\n" > %t.expected 41 // RUN: %{exec} "%t.exe" > %t.actual 42 // RUN: diff -u %t.actual %t.expected 43 44 #include <print> 45 46 int main(int, char**) { 47 // The data is passed as-is so it does not depend on the encoding of the input. 48 std::println("{} {}", 1234, "一二三四"); 49 std::println("{} {}", true, nullptr); 50 51 return 0; 52 } 53