Fix ignore option and add first tests

Change-Id: I1c91853befa935137f2148169be0089365c521a8
This commit is contained in:
Tristan Cacqueray
2014-05-16 18:39:58 +00:00
parent 509a91ffd7
commit c7485c8bad
2 changed files with 13 additions and 2 deletions

View File

@@ -58,6 +58,8 @@ def should_ignore(error):
def print_error(error, line,
filename=None, filelineno=None):
if should_ignore(error):
return
if not filename:
filename = fileinput.filename()
if not filelineno:

View File

@@ -19,10 +19,19 @@ test_bash8
Tests for `bash8` module.
"""
from bash8 import bash8
from bash8.tests import base
class TestBash8(base.TestCase):
def test_something(self):
pass
def test_multi_ignore(self):
bash8.register_ignores('E001|E011')
bash8.check_no_trailing_whitespace("if ")
bash8.check_if_then("if ")
self.assertEqual(bash8.ERRORS, 0)
def test_ignore(self):
bash8.register_ignores('E001')
bash8.check_no_trailing_whitespace("if ")
self.assertEqual(bash8.ERRORS, 0)