   test "emitted monads include an error for rows with variable length" do
     stream = Stream.map(["a,\"be\"", ",c,d", "e,f", "g,,h", "i,j", "k,l"], &(&1))
 
-    assert stream
-    |> Decoder.decode
-    |> Enum.filter(fn
-      { :error, message } -> message |> String.contains?("row with length")
-    _ -> false
-    end)
-    |> Enum.count == 2
+    errors = stream |> Decoder.decode |> filter_errors |> Enum.into([])
+    assert errors == [
+      error: "Encountered a row with length 3 instead of 2",
+      error: "Encountered a row with length 3 instead of 2"
+    ]
   end
 
   test "delivers correctly ordered rows" do

  test "emitted monads include an error for non-unicode files" do
    stream = "./fixtures/broken-encoding.csv" |> Path.expand(__DIR__) |> File.stream!

    assert CSV.decode(stream)
    |> Enum.into([])
    |> Enum.any?(fn
      { :error, "Invalid encoding" } -> true
    _ -> false
    end)
  end

  test "discards any state in the current message queues when halted" do

  test "emitted monads include an error for each row with fields spanning multiple lines if multiple_escape is false" do
    stream = Stream.map(["a,\"be", "c,d", "e,f\"", "g,h", "i,j", "k,l"], &(&1))

    errors = stream |> Decoder.decode(multiline_escape: false) |> filter_errors |> Enum.into([])
    assert errors == [
      error: "Unterminated escape sequence near 'be'",
      error: "Unterminated escape sequence near 'f'"
    ]
  end

  test "raises an error if rows are of variable length" do
