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

[word-count] Tests fail because expectation and result are… equal! #67

Closed
NobbZ opened this issue Apr 17, 2016 · 3 comments
Closed

[word-count] Tests fail because expectation and result are… equal! #67

NobbZ opened this issue Apr 17, 2016 · 3 comments

Comments

@NobbZ
Copy link
Member

NobbZ commented Apr 17, 2016

So what did I wrong here?

Output of elm-test (slightly reformatted to make the obvious even more obvious!):

  count one word: passed.
  count one of each word: passed.
  multiple occurrences of a word: FAILED. 
    Expected: Dict.fromList [("blue",1),("fish",4),("one",1),("red",1),("two",1)]; 
    got:      Dict.fromList [("blue",1),("fish",4),("one",1),("red",1),("two",1)]
  ignore punctuation: FAILED.
    Expected: Dict.fromList [("as",1),("car",1),("carpet",1),("java",1),("javascript",1)];
    got:      Dict.fromList [("as",1),("car",1),("carpet",1),("java",1),("javascript",1)]
  include numbers: passed
  normalize case: FAILED.
    Expected: Dict.fromList [("go",3),("stop",2)]; 
    got:      Dict.fromList [("go",3),("stop",2)]

Since the results seem to be okay, I have already submitted my solution.

@tgecho
Copy link
Contributor

tgecho commented Apr 17, 2016

Arg... You've run into a rather disturbing (IMO) Elm bug: https://github.com/elm-lang/core/issues/403

It turns out == equality is currently unreliable for data structures such as Dict. I forgot to survey the existing tests for this potential issue after I learned about it.

The best answer I have is to change the test to run the result Dict through toList (which returns in key order) and test against that.

You're welcome to put in a PR to that effect, or I'll do it when I'm back in front of my computer.

@NobbZ
Copy link
Member Author

NobbZ commented Apr 17, 2016

I will try my best. If I do understand you correctly and am able to fix it I'll PR.

NobbZ added a commit to NobbZ/xelm that referenced this issue Apr 17, 2016
There seems to be a bug in elm (elm-lang/core#403) which makes equality
checks fail when the should succeed.

FIX exercism#67
@NobbZ
Copy link
Member Author

NobbZ commented Apr 17, 2016

OK, PR'd, along side another one I had to do to make the build-script more robust for zsh, csh, or fish users (and any non bourne shell I have forgotten).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants