Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upComprehensive rewrite of List tests #150
Conversation
jonathanhefner
added some commits
Jan 29, 2015
jonathanhefner
referenced this pull request
Jan 30, 2015
Merged
Port List functions from JavaScript to Elm #152
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Feb 1, 2015
Member
Very cool, thank you!
My main concern is that if reverse is broken, lots of tests will behave in odd ways. That feels weird to me.
|
Very cool, thank you! My main concern is that if |
pushed a commit
that referenced
this pull request
Feb 1, 2015
evancz
merged commit ced7e63
into
elm:master
Feb 1, 2015
1 check passed
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Feb 1, 2015
Contributor
Regarding the reverse concern, wouldn't the obvious solution be to replace the reverse imported from List by a local, guaranteed-to-be-correct implementation of reverse in these lines:
https://github.com/elm-lang/core/blob/master/tests/Test/List.elm#L111
https://github.com/elm-lang/core/blob/master/tests/Test/List.elm#L157
https://github.com/elm-lang/core/blob/master/tests/Test/List.elm#L161-162
https://github.com/elm-lang/core/blob/master/tests/Test/List.elm#L166-167
?
|
Regarding the https://github.com/elm-lang/core/blob/master/tests/Test/List.elm#L111 ? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jonathanhefner
Feb 1, 2015
Contributor
I agree, it was a concern of mine. The problem is (without TCO) you have to rely on either reverse or map (or their underpinnings: foldl and foldr, respectively). Basically, there is always some non-primitive function you are relying on. But it may be worthwhile to remove as many layers as possible, e.g. limit yourself to just foldl, so I'll make another pass at it soon.
|
I agree, it was a concern of mine. The problem is (without TCO) you have to rely on either |
jonathanhefner commentedJan 29, 2015
I rewrote the List tests to be more comprehensive. The tests now cover all exposed API functions, with the exception of
map3..5(which were also previously not covered). I can add coverage formap3..5as well as non-exposed functions, if desired.The tests are also now parameterized, so that empty list, 1-element list, and N-element list use-cases are all covered equally. This also enables easy stress testing, either for stack overflow checking or for benchmarking.
I tried to keep the code as clean and clear as possible. If there are any parts that need improvement, please let me know.