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 // void println(); 22 23 // Testing this properly is quite hard; the function unconditionally 24 // writes to stdout. When stdout is redirected to a file it is no longer 25 // considered a terminal. The function is a small wrapper around 26 // 27 // template<class... Args> 28 // void println(FILE* stream, format_string<Args...> fmt, Args&&... args); 29 // 30 // So do minimal tests for this function and rely on the FILE* overload 31 // to do more testing. 32 // 33 // The testing is based on the testing for std::cout. 34 35 // TODO PRINT Use lit builtin echo 36 37 // FILE_DEPENDENCIES: echo.sh 38 // RUN: %{build} 39 // RUN: %{exec} bash echo.sh -ne "println blank line test: \n" > %t.expected 40 // RUN: %{exec} "%t.exe" > %t.actual 41 // RUN: diff -u %t.actual %t.expected 42 43 #include <print> 44 45 int main(int, char**) { 46 // On some configurations the `diff -u` test fails if we print a single blank line character `\n`, so we print some text first. 47 std::print("println blank line test: "); 48 std::println(); 49 50 return 0; 51 } 52