Commit 4584974 1 parent 6f4a08c commit 4584974 Copy full SHA for 4584974
File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ gitRepoNameFromCartfileEntry (CartfileEntry GitHub (Location l) _) =
213
213
gitRepoNameFromCartfileEntry (CartfileEntry Git (Location l) _) =
214
214
ProjectName . T. unpack . T. replace " .git" " " . last . splitWithSeparator ' /' . T. pack $ l
215
215
gitRepoNameFromCartfileEntry (CartfileEntry Binary (Location l) _) =
216
- ProjectName . T. unpack . T. replace " .json" " " . last . splitWithSeparator ' /' . T. pack $ l
216
+ ProjectName . T. unpack . head . T. splitOn " .json" . last . splitWithSeparator ' /' . T. pack $ l
217
217
218
218
219
219
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import Data.Either ( rights )
10
10
import Data.List ( intercalate
11
11
, nub
12
12
, intersect
13
+ , isInfixOf
13
14
)
14
15
import Data.Yaml ( decodeEither'
15
16
, encode
@@ -148,6 +149,17 @@ prop_filterRomeFileEntriesByPlatforms_min :: [RomefileEntry] -> [RomefileEntry]
148
149
prop_filterRomeFileEntriesByPlatforms_min base filteringValues =
149
150
(length $ base `filterRomeFileEntriesByPlatforms` filteringValues) <= length base
150
151
152
+ binaryURLPathWithParameters :: Gen String
153
+ binaryURLPathWithParameters = do
154
+ firstPart <- arbitrary
155
+ secondPart <- arbitrary
156
+ lastPart <- arbitrary `suchThat` (\ a -> not $ " /" `isInfixOf` a || " .json" `isInfixOf` a)
157
+ return $ " https://" ++ firstPart ++ " /" ++ secondPart ++ " /" ++ " binary.json?some_paramter=test&" ++ lastPart
158
+
159
+ prop_gitRepoNameFromCartfileEntry_alaways_binary :: String -> Bool
160
+ prop_gitRepoNameFromCartfileEntry_alaways_binary url =
161
+ gitRepoNameFromCartfileEntry (CartfileEntry Binary (Location url) (Version " " )) == ProjectName " binary"
162
+
151
163
main :: IO ()
152
164
main = do
153
165
@@ -189,3 +201,6 @@ main = do
189
201
190
202
putStrLn " prop_filterRomeFileEntriesByPlatforms_filters"
191
203
quickCheck (withMaxSuccess 1000 prop_filterRomeFileEntriesByPlatforms_filters)
204
+
205
+ putStrLn " prop_gitRepoNameFromCartfileEntry_alaways_binary"
206
+ quickCheck (withMaxSuccess 1000 $ forAll binaryURLPathWithParameters prop_gitRepoNameFromCartfileEntry_alaways_binary)
You can’t perform that action at this time.
0 commit comments