Debian Codegraph @

libcxx/test/std/input.output/iostream.format/print.fun/println.blank_line.sh.cpp

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