OILS / spec / stateful / harness_test.py View on Github | oilshell.org

46 lines, 31 significant
1#!/usr/bin/env python3
2"""
3harness_test.py: Tests for harness.py
4"""
5from __future__ import print_function
6
7import sys
8import unittest
9
10import harness # module under test
11
12
13class HarnessTest(unittest.TestCase):
14
15 def setUp(self):
16 pass
17
18 def tearDown(self):
19 pass
20
21 def testPrintResults(self):
22 Result = harness.Result
23
24 shell_pairs = [
25 ('osh', 'bin/osh'),
26 ('bash', 'bash'),
27 ('dash', 'dash'),
28 ]
29 result_table = [
30 [0, Result.OK, Result.OK, Result.OK, 'first'],
31 [1, Result.FAIL, Result.OK, Result.OK, 'second'],
32 ]
33 flaky = {
34 (0, 'bash'): -1,
35 (0, 'osh'): -1,
36 (0, 'dash'): -1,
37 (1, 'osh'): 2,
38 (1, 'bash'): 1,
39 (1, 'dash'): -1,
40 }
41
42 harness.PrintResults(shell_pairs, result_table, flaky, 4, sys.stdout)
43
44
45if __name__ == '__main__':
46 unittest.main()