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 
26 template <class T>
test_set_emit_on_sync()27 void 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 
main(int,char **)35 int 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