annotate lldb/unittests/Host/HostTest.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===-- HostTest.cpp ------------------------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #include "lldb/Host/Host.h"
anatofuz
parents:
diff changeset
10 #include "gtest/gtest.h"
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 using namespace lldb_private;
anatofuz
parents:
diff changeset
13 using namespace llvm;
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 TEST(Host, WaitStatusFormat) {
anatofuz
parents:
diff changeset
16 EXPECT_EQ("W01", formatv("{0:g}", WaitStatus{WaitStatus::Exit, 1}).str());
anatofuz
parents:
diff changeset
17 EXPECT_EQ("X02", formatv("{0:g}", WaitStatus{WaitStatus::Signal, 2}).str());
anatofuz
parents:
diff changeset
18 EXPECT_EQ("S03", formatv("{0:g}", WaitStatus{WaitStatus::Stop, 3}).str());
anatofuz
parents:
diff changeset
19 EXPECT_EQ("Exited with status 4",
anatofuz
parents:
diff changeset
20 formatv("{0}", WaitStatus{WaitStatus::Exit, 4}).str());
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 TEST(Host, GetEnvironment) {
anatofuz
parents:
diff changeset
24 putenv(const_cast<char *>("LLDB_TEST_ENVIRONMENT_VAR=Host::GetEnvironment"));
anatofuz
parents:
diff changeset
25 ASSERT_EQ("Host::GetEnvironment",
anatofuz
parents:
diff changeset
26 Host::GetEnvironment().lookup("LLDB_TEST_ENVIRONMENT_VAR"));
anatofuz
parents:
diff changeset
27 }