From a3c36d93d236c8c4c1d8263e99edf70d24a043f4 Mon Sep 17 00:00:00 2001 From: Piotr Semenov Date: Thu, 30 Jun 2016 11:45:37 +0300 Subject: [PATCH] [FEATURE] Adds the unit-test for case "NOLINT, NOLINTNEXTLINE works for };". --- cpplint/cpplint_unittest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cpplint/cpplint_unittest.py b/cpplint/cpplint_unittest.py index fd059fb..07a443f 100755 --- a/cpplint/cpplint_unittest.py +++ b/cpplint/cpplint_unittest.py @@ -521,6 +521,21 @@ class CpplintTest(CpplintTestBase): ''], error_collector) self.assertEquals('', error_collector.Results()) + # NOLINT, NOLINTNEXTLINE silences the readability/braces warning for "};". + error_collector = ErrorCollector(self.assert_) + cpplint.ProcessFileData('test.cc', 'cc', + ['// Copyright 2014 Your Company.', + 'for (int i = 0; i != 100; ++i) {', + '\tstd::cout << i << std::endl;', + '}; // NOLINT', + 'for (int i = 0; i != 100; ++i) {', + '\tstd::cout << i << std::endl;', + '// NOLINTNEXTLINE', + '};', + '// LINT_KERNEL_FILE', + ''], + error_collector) + self.assertEquals('', error_collector.Results()) # Test Variable Declarations. def testVariableDeclarations(self):