aboutsummaryrefslogtreecommitdiff
blob: 7bdbc2682458ae55758bb4508133b300f8aa60ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//===--------------------- TildeExpressionResolver.h ------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_UNITTESTS_UTILITY_MOCKS_MOCK_TILDE_EXPRESSION_RESOLVER_H
#define LLDB_UNITTESTS_UTILITY_MOCKS_MOCK_TILDE_EXPRESSION_RESOLVER_H

#include "lldb/Utility/TildeExpressionResolver.h"

#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"

namespace lldb_private {
class MockTildeExpressionResolver : public TildeExpressionResolver {
  llvm::StringRef CurrentUser;
  llvm::StringMap<llvm::StringRef> UserDirectories;

public:
  MockTildeExpressionResolver(llvm::StringRef CurrentUser,
                              llvm::StringRef HomeDir);

  void AddKnownUser(llvm::StringRef User, llvm::StringRef HomeDir);
  void Clear();
  void SetCurrentUser(llvm::StringRef User);

  bool ResolveExact(llvm::StringRef Expr,
                    llvm::SmallVectorImpl<char> &Output) override;
  bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override;
};
} // namespace lldb_private

#endif