git.iko.soy/typeable/libphonenumber
on main help sign in
Tweak tests
commit5a14d9c30454ffa5f5ea69ea07590beacf85c23a authormniip <mniip@mniip.com> dateTue 21 Mar 2023, 11:56 (4 years ago) parent47cd576
1 file changed+5−4
test/Spec.hs+5−4
test/Spec.hs+5−4
@@ -124,11 +124,12 @@ main = hspec $ modifyMaxSuccess (* 10) $ do
124124 BSC.all (`elem` ['0'..'9']) $ nationalSignificantNumber pn
125125 modifyMaxDiscardRatio (* 10) $ do
126126 prop "concatenated with country code parses to the original (if valid and not MX)" $
127− \(ParsedNumber (_, _, ParserInput input) pn) ->
127+ \(ParsedNumber (_, mReg, ParserInput input) pn) ->
128128 -- Apparently "+52112210000000" makes the parser/formatter do weird
129129 -- stuff as it tries to handle the deprecated (?) mobile token ("1"
130130 -- after "+52")
131− if "5211" `BS.isPrefixOf` normalizeNumber Digits input
131+ if "5211" `BS.isPrefixOf` normalizeNumber Digits input ||
132+ mReg == Just "MX" && "11" `BS.isPrefixOf` normalizeNumber Digits input
132133 then discard
133134 else isValidNumber Nothing pn ==>
134135 let
@@ -219,8 +220,8 @@ main = hspec $ modifyMaxSuccess (* 10) $ do
219220 describe "possibleNumber" $ do
220221 modifyMaxDiscardRatio (* 10) $ do
221222 prop "with Unknown is more lenient than isValidNumber" $
222− \(ParsedNumber _ pn) ->
223− isValidNumber Nothing pn ==> possibleNumber Unknown pn === IsPossible
223+ \(ParsedNumber _ pn) -> isValidNumber Nothing pn ==>
224+ possibleNumber Unknown pn `elem` [IsPossible, IsPossibleLocalOnly]
224225
225226 describe "canBeInternationallyDialed" $ do
226227 pure ()