diff --git a/scripts/Core/LineConveyor/CommentRemover.py b/scripts/Core/LineConveyor/CommentRemover.py index 6624671..4567066 100644 --- a/scripts/Core/LineConveyor/CommentRemover.py +++ b/scripts/Core/LineConveyor/CommentRemover.py @@ -2,5 +2,9 @@ class CommentRemover: def processLine(self, line): assert line is not None + newLine = line + index = line.find('#') + if index >= 0: + newLine = line[:index] - + return newLine \ No newline at end of file diff --git a/scripts/Tests/UnitTests/LineConveyor/test_commentRemover.py b/scripts/Tests/UnitTests/LineConveyor/test_commentRemover.py new file mode 100644 index 0000000..5c0baf8 --- /dev/null +++ b/scripts/Tests/UnitTests/LineConveyor/test_commentRemover.py @@ -0,0 +1,19 @@ +import unittest +from Core.LineConveyor.CommentRemover import CommentRemover + + +class TestCommentRemover(unittest.TestCase): + def setUp(self): + self.commentRemover = CommentRemover() + + def test_startsWithComment(self): + line = '# this line is comment' + newLine = self.commentRemover.processLine(line) + + self.assertEqual('', newLine) + + def test_containsComment(self): + line = 'this line contains # a comment' + newLine = self.commentRemover.processLine(line) + + self.assertEqual('this line contains ', newLine) \ No newline at end of file