We're updating the issue view to help you get more done. 

Generative test for sequence implementations

Description

This is an attempt to write a minimal-foreknowledge failing test for CLJ-1633. By minimal-foreknowledge, I mean a test that fails in the presence of the bug, but which one could imagine writing without intimate knowledge of the details of the bug. I suspect that looking for tests like this is a good way to find gaps in test coverage, and produce tests that will uncover novel regressions later on.

Approach: Generate a single list of operations that could be performed on a sequence, changing that sequence. Make two copies of that operation list, and insert what should be identity-preserving operations into each. Run the two lists of operations and verify that the final results are the same.

With CLJ-1633 unfixed, we get this output:

1 2 3 4 5 6 7 8 9 10 11 [java] Testing clojure.test-clojure.sequences [java] [java] FAIL in (seq-gentest) (sequences.clj:135) [java] {:acts1 (->> nil (cons :foo) (cons :foo) into-array next (apply list)), [java] :acts2 (->> nil (cons :foo) (cons :foo) next), [java] :result1 (:foo :foo), [java] :result2 (:foo), [java] :pass false} [java] [java] expected: (:result res) [java] actual: false

Environment

None

Status

Assignee

Michael Blume

Reporter

Michael Blume

Labels

Approval

Triaged

Patch

Code and Test

Priority

Minor