1//===-- HostTest.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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Host/Host.h"
10#include "gtest/gtest.h"
11
12using namespace lldb_private;
13using namespace llvm;
14
15TEST(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());
21}
22
23TEST(Host, GetEnvironment) {
24 putenv(string: const_cast<char *>("LLDB_TEST_ENVIRONMENT_VAR=Host::GetEnvironment"));
25 ASSERT_EQ("Host::GetEnvironment",
26 Host::GetEnvironment().lookup("LLDB_TEST_ENVIRONMENT_VAR"));
27}
28

source code of lldb/unittests/Host/HostTest.cpp