brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ea2ec65 Raw
46 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: GCC-ALWAYS_INLINE-FIXME12 13// XFAIL: availability-fp_to_chars-missing14 15// <print>16 17// template<class... Args>18//   void print(format_string<Args...> fmt, Args&&... args);19 20// Testing this properly is quite hard; the function unconditionally21// writes to stdout. When stdout is redirected to a file it is no longer22// considered a terminal. The function is a small wrapper around23//24// template<class... Args>25//   void print(FILE* stream, format_string<Args...> fmt, Args&&... args);26//27// So do minimal tests for this function and rely on the FILE* overload28// to do more testing.29//30// The testing is based on the testing for std::cout.31 32// RUN: %{build}33// RUN: echo -n "1234 一二三四 true 0x0" > %t.expected34// RUN: %{exec} %t.exe > %t.actual35// RUN: diff -u %t.actual %t.expected36 37#include <print>38 39int main(int, char**) {40  // The data is passed as-is so it does not depend on the encoding of the input.41  std::print("{} {} ", 1234, "一二三四");42  std::print("{} {}", true, nullptr);43 44  return 0;45}46