Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 patch_orderfile | 6 import patch_orderfile |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 | 9 |
| 10 class TestPatchOrderFile(unittest.TestCase): | 10 class TestPatchOrderFile(unittest.TestCase): |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 patch_orderfile.SymbolInfo(0x42, 0x12, symbol_name2)]} | 94 patch_orderfile.SymbolInfo(0x42, 0x12, symbol_name2)]} |
| 95 symbol_names = patch_orderfile._ExpandSymbolsWithDupsFromSameOffset( | 95 symbol_names = patch_orderfile._ExpandSymbolsWithDupsFromSameOffset( |
| 96 symbols, offset_to_symbol_infos) | 96 symbols, offset_to_symbol_infos) |
| 97 self.assertEquals(len(symbol_names), 2) | 97 self.assertEquals(len(symbol_names), 2) |
| 98 self.assertEquals(symbol_names[0], symbol_name) | 98 self.assertEquals(symbol_names[0], symbol_name) |
| 99 self.assertEquals(symbol_names[1], symbol_name2) | 99 self.assertEquals(symbol_names[1], symbol_name2) |
| 100 | 100 |
| 101 def testPrintSymbolWithPrefixes(self): | 101 def testPrintSymbolWithPrefixes(self): |
| 102 class FakeOutputFile(object): | 102 class FakeOutputFile(object): |
| 103 def __init__(self): | 103 def __init__(self): |
| 104 self.output = [] | 104 self.output = '' |
| 105 def write(self, s): | 105 def write(self, s): |
| 106 self.output.append(s) | 106 self.output = self.output + s |
|
pasko
2015/01/22 17:37:14
did the old version not work? if so, why?
azarchs
2015/01/22 17:44:30
The old one resulted in extra '\n's between output
| |
| 107 test_symbol = "dummySymbol" | 107 test_symbol = "dummySymbol" |
| 108 symbol_names = [test_symbol] | 108 symbol_names = [test_symbol] |
| 109 fake_output = FakeOutputFile() | 109 fake_output = FakeOutputFile() |
| 110 patch_orderfile._PrintSymbolsWithPrefixes(symbol_names, fake_output) | 110 patch_orderfile._PrintSymbolsWithPrefixes(symbol_names, fake_output) |
| 111 expected_output = """.text.startup.dummySymbol | 111 expected_output = """.text.startup.dummySymbol |
| 112 .text.hot.dummySymbol | 112 .text.hot.dummySymbol |
| 113 .text.unlikely.dummySymbol | 113 .text.unlikely.dummySymbol |
| 114 .text.dummySymbol | 114 .text.dummySymbol |
| 115 """ | 115 """ |
| 116 self.assertEquals("\n".join(fake_output.output), expected_output) | 116 self.assertEquals(fake_output.output, expected_output) |
| 117 | 117 |
| 118 | 118 |
| 119 if __name__ == "__main__": | 119 if __name__ == "__main__": |
| 120 unittest.main() | 120 unittest.main() |
| OLD | NEW |