Skip to content

Commit

Permalink
Ignore files that start with a . (#3072)
Browse files Browse the repository at this point in the history
- Closes #3068
  • Loading branch information
janmasrovira authored Sep 30, 2024
1 parent 6e58aad commit deca981
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Juvix/Data/FileExt.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,14 @@ instance Show FileExt where
instance Pretty FileExt where
pretty = pretty . fileExtToText

isHidden :: Path b File -> Bool
isHidden = (== ".") . take 1 . toFilePath

isJuvixOrJuvixMdFile :: Path b File -> Bool
isJuvixOrJuvixMdFile = isJuvixFile .||. isJuvixMarkdownFile

isJuvixFile :: Path b File -> Bool
isJuvixFile = (== Just juvixFileExt) . fileExtension
isJuvixFile = (not . isHidden) .&&. ((== Just juvixFileExt) . fileExtension)

isJuvixMarkdownFile :: Path b File -> Bool
isJuvixMarkdownFile p = case splitExtension p of
Expand Down
4 changes: 4 additions & 0 deletions test/Scope/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,9 @@ tests =
posTest
"Proper formatting of import module path"
$(mkRelDir "issue2737")
$(mkRelFile "main.juvix"),
posTest
"Ignore dot files"
$(mkRelDir "issue3068")
$(mkRelFile "main.juvix")
]
1 change: 1 addition & 0 deletions tests/positive/issue3068/.hidden.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nothing to see here
9 changes: 9 additions & 0 deletions tests/positive/issue3068/Package.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Package;

import PackageDescription.V2 open;

package : Package :=
defaultPackage@?{
name := "issue3068";
dependencies := []
};
1 change: 1 addition & 0 deletions tests/positive/issue3068/main.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module main;
9 changes: 9 additions & 0 deletions tests/smoke/Commands/typecheck.smoke.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
working-directory: ./../../../tests/
tests:
- name: ignore-dot-file
working-directory: ./../../../tests/positive/issue3068
command:
- juvix
- typecheck
stderr:
equals: "Well done! It type checks\n"
exit-status: 0

- name: flag-help-shows-juvix-file-for-autocompletion
command:
- juvix
Expand Down

0 comments on commit deca981

Please sign in to comment.