1 //===-- HostTest.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/Host/Host.h"
10 #include "gtest/gtest.h"
12 using namespace lldb_private
;
15 TEST(Host
, WaitStatusFormat
) {
16 EXPECT_EQ("W01", formatv("{0:g}", WaitStatus
{WaitStatus::Exit
, 1}).str());
17 EXPECT_EQ("X02", formatv("{0:g}", WaitStatus
{WaitStatus::Signal
, 2}).str());
18 EXPECT_EQ("S03", formatv("{0:g}", WaitStatus
{WaitStatus::Stop
, 3}).str());
19 EXPECT_EQ("Exited with status 4",
20 formatv("{0}", WaitStatus
{WaitStatus::Exit
, 4}).str());
23 TEST(Host
, GetEnvironment
) {
24 putenv(const_cast<char *>("LLDB_TEST_ENVIRONMENT_VAR=Host::GetEnvironment"));
25 ASSERT_EQ("Host::GetEnvironment",
26 Host::GetEnvironment().lookup("LLDB_TEST_ENVIRONMENT_VAR"));