1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3###############################################################################
4#
5# Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13#
14# The above copyright notice and this permission notice shall be included
15# in all copies or substantial portions of the Software.
16#
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23# SOFTWARE.
24#
25# https://www.opensource.org/licenses/mit-license.php
26#
27###############################################################################
28
29import sys
30import os
31import unittest
32# Ensure python finds the local simpletap module
33sys.path.append(os.path.dirname(os.path.abspath(__file__)))
34
35from basetest import Task, TestCase
36
37
38class TestPrintEmptyColumns(TestCase):
39    def setUp(self):
40        """Executed before each test in the class"""
41        self.t = Task()
42
43
44    def test_empty_columns_feature(self):
45        """Verify rc.print.empty.columns:yes shows more nothing than rc.print.empty.columns:no"""
46        self.t("add one")
47        self.t("add two project:work")
48
49        # Should show empty 'Project' column.
50        code, out, err = self.t("rc.print.empty.columns:yes /one/ list")
51        self.assertIn("Project", out)
52
53        # Should show populated 'Project' column.
54        code, out, err = self.t("rc.print.empty.columns:yes /two/ list")
55        self.assertIn("Project", out)
56
57        # Should not show empty 'Project' column.
58        code, out, err = self.t("rc.print.empty.columns:no /one/ list")
59        self.assertNotIn("Project", out)
60
61        # Should show populated 'Project' column.
62        code, out, err = self.t("rc.print.empty.columns:no /two/ list")
63        self.assertIn("Project", out)
64
65
66if __name__ == "__main__":
67    from simpletap import TAPTestRunner
68    unittest.main(testRunner=TAPTestRunner())
69
70# vim: ai sts=4 et sw=4 ft=python
71