Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchical tags #115

Merged
merged 25 commits into from
Apr 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove old commented test
  • Loading branch information
felko committed Apr 17, 2020
commit cfe2de5c3ec49cea7b4e5a1d4a6e7917c804e781
39 changes: 0 additions & 39 deletions test/Neuron/Zettelkasten/TagSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,42 +51,3 @@ tagMatchCases =
True
)
]
felko marked this conversation as resolved.
Show resolved Hide resolved
{-
shouldMatch :: Z.TagPattern -> Z.Tag -> Expectation
shouldMatch pat tag = Z.tagMatch pat tag `shouldBe` True

shouldNotMatch :: Z.TagPattern -> Z.Tag -> Expectation
shouldNotMatch pat tag = Z.tagMatch pat tag `shouldBe` False

spec :: Spec
spec = do
describe "Tags" $ do
let mathTags =
[ Z.Tag "math/calculus",
Z.Tag "math/topology",
Z.Tag "math/algebra",
Z.Tag "math/algebra/linear",
Z.Tag "math/algebra/homological"
] ::
[Z.Tag]
journalNoteTag = Z.Tag "journal/note"
courseNoteTags =
[ Z.Tag "course/math/note",
Z.Tag "course/sociology/note"
] ::
[Z.Tag]
noteTags = journalNoteTag : courseNoteTags
it "matches itself when is a literal pattern" $ do
forM_ mathTags $ \tag -> Z.literalPattern tag `shouldMatch` tag
it "handles infix globs correctly" $ do
let pat = Z.TagPattern "course/*/note"
shouldMatch pat `mapM_` courseNoteTags
shouldNotMatch pat journalNoteTag
context "recursive glob" $ do
it "matches end of tag" $ do
Z.TagPattern "math/**" `shouldMatch` Z.Tag "math"
it "matches eagerly when terminal" $ do
shouldMatch (Z.TagPattern "math/**") `mapM_` mathTags
it "matches lazily when non terminal" $ do
shouldMatch (Z.TagPattern "**/note") `mapM_` noteTags
-}