Completed
Branch master (b23be4)
by P.R.
01:32
created

test.SDoc1ExpressionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %
Metric Value
dl 0
loc 23
rs 10
wmc 4
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9
import glob
10
import os
11
import unittest
12
13
from sdoc.SDoc import SDoc
14
15
16
class SDoc1ExpressionTest(unittest.TestCase):
17
    """
18
    Test cases for SDoc1 expressions.
19
    """
20
21
    # ------------------------------------------------------------------------------------------------------------------
22
    def testDebug(self):
23
        """
24
        Runs all test cases in the test/debug directory.
25
        """
26
        test_file_names = glob.glob(os.path.dirname(os.path.abspath(__file__)) + "/debug/*.sdoc")
27
28
        for test_file_name in sorted(test_file_names):
29
            with self.subTest(test_file_name=test_file_name):
30
                pre, ext = os.path.splitext(test_file_name)
31
                text_file_name = pre + '.txt'
32
                with open(text_file_name, 'r') as file:
33
                    text = file.read()
34
35
                sdoc = SDoc()
36
                (stdout, sdoc2) = sdoc.test_sdoc1(test_file_name)
37
38
                self.assertEqual(stdout, text)
39
40
41
# ----------------------------------------------------------------------------------------------------------------------
42