blob: d3ccd0211a4e12ff98ad11c512459f33d8808cdc [file] [log] [blame]
Pavel Labath5fae71c2017-02-10 11:49:21 +00001//===-- StreamCallbackTest.cpp ----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Zachary Turnerfb1a0a02017-03-06 18:34:25 +000010#include "lldb/Utility/StreamCallback.h"
Pavel Labath5fae71c2017-02-10 11:49:21 +000011#include "gtest/gtest.h"
12
13using namespace lldb;
14using namespace lldb_private;
15
16static char test_baton;
17static size_t callback_count = 0;
18static void TestCallback(const char *data, void *baton) {
19 EXPECT_STREQ("Foobar", data);
20 EXPECT_EQ(&test_baton, baton);
21 ++callback_count;
22}
23
24TEST(StreamCallbackTest, Callback) {
25 StreamCallback stream(TestCallback, &test_baton);
26 stream << "Foobar";
27 EXPECT_EQ(1u, callback_count);
28}