OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import unittest | 8 import unittest |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 test_cases = ( | 43 test_cases = ( |
44 ('foo\\0', ['foo']), | 44 ('foo\\0', ['foo']), |
45 ('foo\\001bar\\0', ['foo', 'bar']), | 45 ('foo\\001bar\\0', ['foo', 'bar']), |
46 ('\\"foo\\"\\0', ['"foo"']), | 46 ('\\"foo\\"\\0', ['"foo"']), |
47 ) | 47 ) |
48 for actual, expected in test_cases: | 48 for actual, expected in test_cases: |
49 self.assertEquals( | 49 self.assertEquals( |
50 expected, | 50 expected, |
51 trace_inputs.Dtrace.Context.process_escaped_arguments(actual)) | 51 trace_inputs.Dtrace.Context.process_escaped_arguments(actual)) |
52 | 52 |
53 | |
54 def test_variable_abs(self): | 53 def test_variable_abs(self): |
55 value = trace_inputs.Results.File(None, '/foo/bar', False, False) | 54 value = trace_inputs.Results.File(None, '/foo/bar', False, False) |
56 actual = value.replace_variables({'$FOO': '/foo'}) | 55 actual = value.replace_variables({'$FOO': '/foo'}) |
57 self.assertEquals('$FOO/bar', actual.path) | 56 self.assertEquals('$FOO/bar', actual.path) |
58 self.assertEquals('$FOO/bar', actual.full_path) | 57 self.assertEquals('$FOO/bar', actual.full_path) |
59 self.assertEquals(True, actual.tainted) | 58 self.assertEquals(True, actual.tainted) |
60 | 59 |
61 def test_variable_rel(self): | 60 def test_variable_rel(self): |
62 value = trace_inputs.Results.File('/usr', 'foo/bar', False, False) | 61 value = trace_inputs.Results.File('/usr', 'foo/bar', False, False) |
63 actual = value.replace_variables({'$FOO': 'foo'}) | 62 actual = value.replace_variables({'$FOO': 'foo'}) |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 'size': -1, | 417 'size': -1, |
419 }, | 418 }, |
420 ] | 419 ] |
421 self._test_lines(lines, '/home/foo_bar_user/src', files) | 420 self._test_lines(lines, '/home/foo_bar_user/src', files) |
422 | 421 |
423 | 422 |
424 if __name__ == '__main__': | 423 if __name__ == '__main__': |
425 VERBOSE = '-v' in sys.argv | 424 VERBOSE = '-v' in sys.argv |
426 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 425 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
427 unittest.main() | 426 unittest.main() |
OLD | NEW |