brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · b884738 Raw
53 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2010// UNSUPPORTED: no-filesystem11// UNSUPPORTED: executor-has-no-bash12// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME13 14// FIXME PRINT How to test println on Windows?15// XFAIL: msvc, target={{.+}}-windows-gnu16 17// XFAIL: availability-fp_to_chars-missing18 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 unconditionally25// writes to stdout. When stdout is redirected to a file it is no longer26// considered a terminal. The function is a small wrapper around27//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* overload32// to do more testing.33//34// The testing is based on the testing for std::cout.35 36// TODO PRINT Use lit builtin echo37 38// FILE_DEPENDENCIES: echo.sh39// RUN: %{build}40// RUN: %{exec} bash echo.sh -ne "1234 一二三四\ntrue 0x0\n" > %t.expected41// RUN: %{exec} "%t.exe" > %t.actual42// RUN: diff -u %t.actual %t.expected43 44#include <print>45 46int 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