Page MenuHomePhabricator

[unittests] Fix ExpandTilde test to match handling home dirs with trailing slash
ClosedPublic

Authored by atanasyan on Nov 20 2018, 5:49 AM.

Details

Summary

The expandTildeExpr routine just replaces a tilde by a home dir path. If the home dir has a trailing slash, the result of substitution will contain double slash. For example, HOME=/foo/ ~/bar gives /foo//bar. That corresponds to (at least) Bash behaviour because the following command $HOME=/foo/ echo ~/bar prints /foo//bar.

The ExpandTilde test constructs a path expected as the fs::expand_tilde call result by calling path::append and the expected path has a single slash. This patch fixes that and allows to pass the unittest on hosts where the HOME is /.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Nov 20 2018, 5:49 AM
JDevlieghere accepted this revision.Nov 20 2018, 12:49 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Nov 20 2018, 12:49 PM
This revision was automatically updated to reflect the committed changes.