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
10// UNSUPPORTED: no-localization
11// UNSUPPORTED: libcpp-has-no-experimental-syncstream
12
13// <syncstream>
14
15// template <class charT, class traits, class Allocator>
16// class basic_syncbuf;
17
18// void set_emit_on_sync(bool) noexcept;
19
20#include <syncstream>
21#include <cassert>
22
23#include "test_macros.h"
24#include "../helpers.h"
25
26template <class T>
27void test_set_emit_on_sync() {
28 // set_emit_on_sync tested in sync, which is called by pubsync. The assign
29 // and swap test use this.
30 test_syncbuf<T, std::allocator<T>> buff(nullptr, std::allocator<T>());
31 ASSERT_NOEXCEPT(buff.set_emit_on_sync(false));
32 buff.set_emit_on_sync(false); // Validates the function can be called.
33}
34
35int main(int, char**) {
36 test_set_emit_on_sync<char>();
37#ifndef TEST_HAS_NO_WIDE_CHARACTERS
38 test_set_emit_on_sync<wchar_t>();
39#endif
40
41 return 0;
42}
43

source code of libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.members/set_emit_on_sync.pass.cpp