ceylon/ceylon-sdk — pull request #238 by renatoathaydes (2014-05-25 21:39:27+00:00)
Title: More list tests

Implemented tests for all methods of ``Correspondence`` and ``Iterable`` and made all test classes for ``Iterable`` implementators satisfy the new ``IterableTests`` and its specializations.

Also fixed a bug found in ``LinkedList``.

The test classes hierarchy now looks something like this (starting from the bottom):

``CorrespondenceTests`` -> ``IterableTests`` ->
``InsertionOrderIterableTests`` ->
``HashSetTest``
``InsertionOrderIterableWithNullsTests`` ->
``ListTests`` ->
``ArrayListTest``
``LinkedListTest``
``NaturalOrderIterableTests`` -> ``TreeSetTest``
``HashOrderIterableTests`` -> ``HashSetTest(unlinked)``

This is incomplete as it would be hard to "draw" the hierarchy correctly. But the rest is pretty obvious:
* ``ListTests`` satisfies ``RangedTests`` & ``CorrespondenceTests``
& ``InsertionOrderIterableWithNullsTests``
* ``SetTests`` satisfies ``IterableTests``

So, tests for ``Set``s are still incomplete... in this PR I was focusing on lists. Will try to complete tests for ``Set``s and ``Map``s in other pull requests.

Notice that I intentionally did not include ``IterableTests`` for ``PriorityQueue`` because it just fails nearly all tests. If the Ceylon team wants, I can make the priority-queue test satisfy ``NaturalOrderIterableTests`` (I believe it should pass all tests because you can make the priority of the queue be given by the natural order of the elements, but is just doesn't right now) but this will break the tests and seems like it would be a lot of work to fix it. Maybe this class should be removed for now.

Finally, the ``repeat`` and ``cycle`` tests for all ``Set``s are failing because they don't return duplicates, so trying to ``repeat`` a ``Set`` any number of times will just give back the same ``Set``. This breaks the contract of ``Iterable.repeat`` and ``cycle``, so I believe this is a bug. What do you think?