1 //===- llvm/unittest/Support/DebugTest.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 "llvm/Support/Debug.h"
10 #include "llvm/Support/raw_ostream.h"
11 #include "gtest/gtest.h"
17 TEST(DebugTest
, Basic
) {
19 raw_string_ostream
os1(s1
), os2(s2
);
20 static const char *DT
[] = {"A", "B"};
22 llvm::DebugFlag
= true;
23 setCurrentDebugTypes(DT
, 2);
24 DEBUG_WITH_TYPE("A", os1
<< "A");
25 DEBUG_WITH_TYPE("B", os1
<< "B");
26 EXPECT_EQ("AB", os1
.str());
28 setCurrentDebugType("A");
29 DEBUG_WITH_TYPE("A", os2
<< "A");
30 DEBUG_WITH_TYPE("B", os2
<< "B");
31 EXPECT_EQ("A", os2
.str());