Pretty: handle tilde in paths
This commit is contained in:
parent
9937453ef2
commit
7ef7a0bb00
|
@ -183,6 +183,7 @@ prettyNix = withoutParens . cata phi where
|
|||
"../" -> "../."
|
||||
".." -> "../."
|
||||
txt | "/" `isPrefixOf` txt -> txt
|
||||
| "~/" `isPrefixOf` txt -> txt
|
||||
| "./" `isPrefixOf` txt -> txt
|
||||
| "../" `isPrefixOf` txt -> txt
|
||||
| otherwise -> "./" ++ txt
|
||||
|
|
|
@ -24,6 +24,12 @@ case_function_params :: Assertion
|
|||
case_function_params =
|
||||
assertPretty (mkFunction (mkParamset [] True) (mkInt 3)) "{ ... }:\n 3"
|
||||
|
||||
case_paths :: Assertion
|
||||
case_paths = do
|
||||
assertPretty (mkPath False "~/test.nix") "~/test.nix"
|
||||
assertPretty (mkPath False "/test.nix") "/test.nix"
|
||||
assertPretty (mkPath False "./test.nix") "./test.nix"
|
||||
|
||||
tests :: TestTree
|
||||
tests = $testGroupGenerator
|
||||
|
||||
|
|
Loading…
Reference in a new issue