diff options
author | 2017-06-27 16:10:16 +0200 | |
---|---|---|
committer | 2017-06-28 10:17:03 +0200 | |
commit | 40d2110d4fba631adb488002cc6440a94a1a52d5 (patch) | |
tree | 8a33038944c462f23f47a9ebc4679e7a67a3ccf1 /src/main | |
parent | 5c6db4c3cf2a70293a2e55ac2ff79eb7c817158c (diff) |
cpp: add unit tests for MakeAbsolute()
While fixing its TODO.
Tested with the following command line:
$ bazel test //src/test/cpp/...
Change-Id: I62d5d0f19b7242fd2eeae7901e1e236c782ebfb5
PiperOrigin-RevId: 160270960
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/cpp/blaze_util.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/cpp/blaze_util.cc b/src/main/cpp/blaze_util.cc index fc31b4ba28..2831ead175 100644 --- a/src/main/cpp/blaze_util.cc +++ b/src/main/cpp/blaze_util.cc @@ -38,10 +38,11 @@ using std::vector; const char kServerPidFile[] = "server.pid.txt"; string MakeAbsolute(const string &path) { - // Check if path is already absolute. - // TODO(laszlocsomor): remove the "path.empty() ||" clause; empty paths are - // not absolute! - if (path.empty() || blaze_util::IsAbsolute(path)) { + if (path.empty()) { + return blaze_util::GetCwd(); + } + + if (blaze_util::IsAbsolute(path)) { return path; } |