1 #!/usr/bin/python 2 3 # Tests for litlint.py 4 # 5 # Usage: python litlint_test.py 6 # 7 # Returns nonzero if any test fails 8 9 import litlint 10 import unittest 11 12 class TestLintLine(unittest.TestCase): 13 def test_missing_run(self): 14 f = litlint.LintLine 15 self.assertEqual(f(' %t '), ('missing %run before %t', 2)) 16 self.assertEqual(f(' %t\n'), ('missing %run before %t', 2)) 17 self.assertEqual(f(' %t.so '), (None, None)) 18 self.assertEqual(f(' %t.o '), (None, None)) 19 self.assertEqual(f('%run %t '), (None, None)) 20 self.assertEqual(f('-o %t '), (None, None)) 21 22 if __name__ == '__main__': 23 unittest.main() 24