1 //===-- StreamCallbackTest.cpp --------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/StreamCallback.h"
10 #include "gtest/gtest.h"
13 using namespace lldb_private
;
15 static char test_baton
;
16 static size_t callback_count
= 0;
17 static void TestCallback(const char *data
, void *baton
) {
18 EXPECT_STREQ("Foobar", data
);
19 EXPECT_EQ(&test_baton
, baton
);
23 TEST(StreamCallbackTest
, Callback
) {
24 StreamCallback
stream(TestCallback
, &test_baton
);
26 EXPECT_EQ(1u, callback_count
);