53 lines · cpp
1//===-- DebuggerTest.cpp --------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/Core/Debugger.h"10#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"11#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"12#include "TestingSupport/TestUtilities.h"13#include "lldb/Host/FileSystem.h"14#include "lldb/Host/HostInfo.h"15#include "gtest/gtest.h"16 17using namespace lldb;18using namespace lldb_private;19 20namespace {21class DebuggerTest : public ::testing::Test {22public:23 void SetUp() override {24 FileSystem::Initialize();25 HostInfo::Initialize();26 PlatformMacOSX::Initialize();27 std::call_once(TestUtilities::g_debugger_initialize_flag,28 []() { Debugger::Initialize(nullptr); });29 ArchSpec arch("x86_64-apple-macosx-");30 Platform::SetHostPlatform(31 PlatformRemoteMacOSX::CreateInstance(true, &arch));32 }33 void TearDown() override {34 PlatformMacOSX::Terminate();35 HostInfo::Terminate();36 FileSystem::Terminate();37 }38};39} // namespace40 41TEST_F(DebuggerTest, TestSettings) {42 DebuggerSP debugger_sp = Debugger::CreateInstance();43 44 EXPECT_TRUE(debugger_sp->SetUseColor(true));45 EXPECT_TRUE(debugger_sp->GetUseColor());46 47 FormatEntity::Entry format("foo");48 EXPECT_TRUE(debugger_sp->SetStatuslineFormat(format));49 EXPECT_EQ(debugger_sp->GetStatuslineFormat().string, "foo");50 51 Debugger::Destroy(debugger_sp);52}53