From c7485c8bad9a5a0004cb663fd83b3bc492bb4b8d Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 16 May 2014 18:39:58 +0000 Subject: [PATCH] Fix ignore option and add first tests Change-Id: I1c91853befa935137f2148169be0089365c521a8 --- bash8/bash8.py | 2 ++ bash8/tests/test_bash8.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bash8/bash8.py b/bash8/bash8.py index 8daac4e..a4bce78 100644 --- a/bash8/bash8.py +++ b/bash8/bash8.py @@ -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: diff --git a/bash8/tests/test_bash8.py b/bash8/tests/test_bash8.py index 349a6dc..d6a7c1a 100644 --- a/bash8/tests/test_bash8.py +++ b/bash8/tests/test_bash8.py @@ -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)