OLD | NEW |
1 # -*- coding: utf-8; -*- | 1 # -*- coding: utf-8; -*- |
2 # | 2 # |
3 # Copyright (C) 2009 Google Inc. All rights reserved. | 3 # Copyright (C) 2009 Google Inc. All rights reserved. |
4 # Copyright (C) 2009 Torch Mobile Inc. | 4 # Copyright (C) 2009 Torch Mobile Inc. |
5 # Copyright (C) 2009 Apple Inc. All rights reserved. | 5 # Copyright (C) 2009 Apple Inc. All rights reserved. |
6 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 6 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
7 # | 7 # |
8 # Redistribution and use in source and binary forms, with or without | 8 # Redistribution and use in source and binary forms, with or without |
9 # modification, are permitted provided that the following conditions are | 9 # modification, are permitted provided that the following conditions are |
10 # met: | 10 # met: |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 # We provide this function so the caller can pass it to the | 713 # We provide this function so the caller can pass it to the |
714 # StyleProcessor constructor. This lets us assert the equality of | 714 # StyleProcessor constructor. This lets us assert the equality of |
715 # the DefaultStyleErrorHandler instance generated by the process() | 715 # the DefaultStyleErrorHandler instance generated by the process() |
716 # method with an expected instance. | 716 # method with an expected instance. |
717 pass | 717 pass |
718 | 718 |
719 def _swallow_stderr_message(self, message): | 719 def _swallow_stderr_message(self, message): |
720 """Swallow a message passed to stderr.write().""" | 720 """Swallow a message passed to stderr.write().""" |
721 # This is a mock stderr.write() for passing to the constructor | 721 # This is a mock stderr.write() for passing to the constructor |
722 # of the StyleProcessorConfiguration class. | 722 # of the StyleProcessorConfiguration class. |
723 pass | |
724 | 723 |
725 def _create_carriage_checker_class(self): | 724 def _create_carriage_checker_class(self): |
726 | 725 |
727 # Create a reference to self with a new name so its name does not | 726 # Create a reference to self with a new name so its name does not |
728 # conflict with the self introduced below. | 727 # conflict with the self introduced below. |
729 test_case = self | 728 test_case = self |
730 | 729 |
731 class MockCarriageChecker(object): | 730 class MockCarriageChecker(object): |
732 | 731 |
733 """A mock carriage-return checker.""" | 732 """A mock carriage-return checker.""" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 """Test that carriage returns aren't stripped from files that are allowe
d to contain them.""" | 811 """Test that carriage returns aren't stripped from files that are allowe
d to contain them.""" |
813 file_path = 'carriage_returns_allowed.txt' | 812 file_path = 'carriage_returns_allowed.txt' |
814 lines = ['line1\r', 'line2\r'] | 813 lines = ['line1\r', 'line2\r'] |
815 line_numbers = [100] | 814 line_numbers = [100] |
816 self._processor.process(lines=lines, | 815 self._processor.process(lines=lines, |
817 file_path=file_path, | 816 file_path=file_path, |
818 line_numbers=line_numbers) | 817 line_numbers=line_numbers) |
819 # The carriage return checker should never have been invoked, and so | 818 # The carriage return checker should never have been invoked, and so |
820 # should not have saved off any lines. | 819 # should not have saved off any lines. |
821 self.assertFalse(hasattr(self.carriage_checker, 'lines')) | 820 self.assertFalse(hasattr(self.carriage_checker, 'lines')) |
OLD | NEW |