Pull Request: tests for Phone Number exercise may have false positives for letters and symbols

The test cases “invalid with letters” and “invalid with punctuations” use area codes that begin with 1, which could cause the code under test to reject the phone number without ever checking for letters or punctuation.

For example, this community solution should fail these two tests

I’ve created a PR to make these tests more specific Fix false positives in checks for letters and punctuation by dr-impossible · Pull Request #1217 · exercism/haskell · GitHub

That data comes from the problem spec and should ideally remain synced to the problem spec.

Please see Suggesting Exercise Improvements | Exercism's Docs and related docs. If you’d like to change the problem specs, please read the docs and propose a change on the forum for discussion prior to opening a PR.

Thanks, that makes sense. I’ll bring this up in the problem spec then.

I did some further digging and it looks like the problem spec was updated to address this problem, but the tests in the Haskell version have not been updated to reflect this change. What’s the correct way to update the Haskell tests to reflect this change?

1 Like

Some tracks have tooling to sync/update tests. Others require people manually sync the files. I’m not familiar with the Haskell track so I have no idea how it is set up.

@ErikSchierboom will know but he’s away this week. If noone else gets back to your first he will next week :)

1 Like

There is no test generator for Haskell, so you’ll have to manually update the tests.
The tests can be found here: haskell/exercises/practice/phone-number/test/Tests.hs at main · exercism/haskell · GitHub
Note that you might also need to update the example solution, as it might not pass the new tests: haskell/exercises/practice/phone-number/.meta/examples/success-standard/src/Phone.hs at main · exercism/haskell · GitHub

Hi Erik,

I’ve updated the tests and problem description and created a new PR
Synchronized tests for phone-number exercise by dr-impossible · Pull Request #1219 · exercism/haskell · GitHub

I reran the example solution against the updated tests and it passes, so no changes were needed there. As a bonus I’ve now had my first introduction to the >>= operator :slight_smile:

1 Like