mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Token matches can occur at the beginning or end of a file
This commit is contained in:
parent
b7aefe66d0
commit
697f8b4135
@ -7,7 +7,7 @@ import Unused.Regex
|
||||
commandLineOptions :: String -> [String]
|
||||
commandLineOptions t =
|
||||
case regexSafeTerm t of
|
||||
True -> ["\\W" ++ t ++ "\\W", ".", "-c", "--ackmate"]
|
||||
True -> ["(\\W|^)" ++ t ++ "(\\W|$)", ".", "-c", "--ackmate"]
|
||||
False -> [t, ".", "-c", "-Q", "--ackmate"]
|
||||
|
||||
regexSafeTerm :: String -> Bool
|
||||
|
@ -19,4 +19,4 @@ spec = parallel $
|
||||
commandLineOptions "window.globalOverride" `shouldBe` ["window.globalOverride", ".", "-c", "-Q", "--ackmate"]
|
||||
|
||||
it "uses regular expression match with surrounding non-word matches for accuracy" $
|
||||
commandLineOptions "awesome_method" `shouldBe` ["\\Wawesome_method\\W", ".", "-c", "--ackmate"]
|
||||
commandLineOptions "awesome_method" `shouldBe` ["(\\W|^)awesome_method(\\W|$)", ".", "-c", "--ackmate"]
|
||||
|
Loading…
Reference in New Issue
Block a user