#!/usr/bin/env python

"""Test suite for rstcheck."""

from __future__ import unicode_literals

import unittest

import rstcheck


class Tests(unittest.TestCase):

    def test_check(self):
        self.assertEqual(
            6,
            list(rstcheck.check(
                """\
Test
====

.. code-block:: python

    print(
"""))[0][0])

    def test_check_with_extra_blank_lines(self):
        self.assertEqual(
            6,
            list(rstcheck.check(
                """\
Test
====

.. code-block:: python

    print(



"""))[0][0])

    def test_check_nested_rst(self):
        self.assertEqual(
            32,
            list(rstcheck.check(
                """\
Test
====

.. code-block:: rst

    Test
    ====

    .. code-block:: rst


        Test
        ====

        .. code-block:: rst

            Test
            ====

            .. code-block:: rst

                Test
                ====

                .. code-block:: rst

                    Test
                    ====

                    .. code-block:: python

                        print(
"""))[0][0])


if __name__ == '__main__':
    unittest.main()

@@ -157,16 +157,166 @@
 Case):%0A%0A
+    def assert_lines_equal(self, line_numbers, results):%0A        self.assertEqual(line_numbers,%0A                         list(dict(results).keys()))%0A%0A
     def 
@@ -344,33 +344,40 @@
      self.assert
-E
+_lines_e
 qual(%0A          
@@ -370,33 +370,35 @@
 al(%0A            
-6
+%5B6%5D
 ,%0A            li
@@ -387,37 +387,32 @@
 6%5D,%0A            
-list(
 rstcheck.check(%0A
@@ -479,31 +479,24 @@
 print(%0A%22%22%22))
-%5B0%5D%5B0%5D)
 %0A%0A    def te
@@ -545,33 +545,40 @@
      self.assert
-E
+_lines_e
 qual(%0A          
@@ -579,17 +579,19 @@
         
-6
+%5B6%5D
 ,%0A      
@@ -588,37 +588,32 @@
 6%5D,%0A            
-list(
 rstcheck.check(%0A
@@ -687,23 +687,16 @@
 %0A%0A%0A%22%22%22))
-%5B0%5D%5B0%5D)
 %0A%0A    de
@@ -741,25 +741,32 @@
  self.assert
-E
+_lines_e
 qual(%0A      
@@ -775,10 +775,12 @@
     
+%5B
 32
+%5D
 ,%0A  
@@ -789,21 +789,16 @@
         
-list(
 rstcheck
@@ -1237,20 +1237,13 @@
 nt(%0A
+
 %22%22%22))
-%5B0%5D%5B0%5D)
 %0A%0A%0Ai

Factor out code