Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: sky/tools/webkitpy/common/checkout/diff_parser_unittest.py

Issue 639883003: Get test_webkitpy to actually run again. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: merge to ToT Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/tools/webkitpy/common/checkout/scm/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2009 Google Inc. All rights reserved. 1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 "\n", 86 "\n",
87 " - Cool Hacker\n", 87 " - Cool Hacker\n",
88 "\n", 88 "\n",
89 ] 89 ]
90 90
91 revision_lines = [ 91 revision_lines = [
92 "Subversion Revision 289799\n", 92 "Subversion Revision 289799\n",
93 ] 93 ]
94 94
95 svn_diff_lines = [ 95 svn_diff_lines = [
96 "Index: Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 96 "Index: tools/webkitpy/common/checkout/diff_parser.py\n",
97 "=================================================================== \n", 97 "=================================================================== \n",
98 "--- Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 98 "--- tools/webkitpy/common/checkout/diff_parser.py\n",
99 "+++ Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 99 "+++ tools/webkitpy/common/checkout/diff_parser.py\n",
100 "@@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):\n", 100 "@@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):\n",
101 ] 101 ]
102 self.assertEqual(diff_parser.get_diff_converter(svn_diff_lines), diff_pa rser.svn_diff_to_svn_diff) 102 self.assertEqual(diff_parser.get_diff_converter(svn_diff_lines), diff_pa rser.svn_diff_to_svn_diff)
103 self.assertEqual(diff_parser.get_diff_converter(comment_lines + svn_diff _lines), diff_parser.svn_diff_to_svn_diff) 103 self.assertEqual(diff_parser.get_diff_converter(comment_lines + svn_diff _lines), diff_parser.svn_diff_to_svn_diff)
104 self.assertEqual(diff_parser.get_diff_converter(revision_lines + svn_dif f_lines), diff_parser.svn_diff_to_svn_diff) 104 self.assertEqual(diff_parser.get_diff_converter(revision_lines + svn_dif f_lines), diff_parser.svn_diff_to_svn_diff)
105 105
106 git_diff_lines = [ 106 git_diff_lines = [
107 "diff --git a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py b/Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 107 "diff --git a/tools/webkitpy/common/checkout/diff_parser.py b/tools/ webkitpy/common/checkout/diff_parser.py\n",
108 "index 3c5b45b..0197ead 100644\n", 108 "index 3c5b45b..0197ead 100644\n",
109 "--- a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 109 "--- a/tools/webkitpy/common/checkout/diff_parser.py\n",
110 "+++ b/Tools/Scripts/webkitpy/common/checkout/diff_parser.py\n", 110 "+++ b/tools/webkitpy/common/checkout/diff_parser.py\n",
111 "@@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):\n", 111 "@@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):\n",
112 ] 112 ]
113 self.assertEqual(diff_parser.get_diff_converter(git_diff_lines), diff_pa rser.git_diff_to_svn_diff) 113 self.assertEqual(diff_parser.get_diff_converter(git_diff_lines), diff_pa rser.git_diff_to_svn_diff)
114 self.assertEqual(diff_parser.get_diff_converter(comment_lines + git_diff _lines), diff_parser.git_diff_to_svn_diff) 114 self.assertEqual(diff_parser.get_diff_converter(comment_lines + git_diff _lines), diff_parser.git_diff_to_svn_diff)
115 self.assertEqual(diff_parser.get_diff_converter(revision_lines + git_dif f_lines), diff_parser.git_diff_to_svn_diff) 115 self.assertEqual(diff_parser.get_diff_converter(revision_lines + git_dif f_lines), diff_parser.git_diff_to_svn_diff)
116 116
117 def test_git_mnemonicprefix(self): 117 def test_git_mnemonicprefix(self):
118 p = re.compile(r' ([a|b])/') 118 p = re.compile(r' ([a|b])/')
119 119
120 prefixes = [ 120 prefixes = [
121 { 'a' : 'i', 'b' : 'w' }, # git-diff (compares the (i)ndex and the ( w)ork tree) 121 { 'a' : 'i', 'b' : 'w' }, # git-diff (compares the (i)ndex and the ( w)ork tree)
122 { 'a' : 'c', 'b' : 'w' }, # git-diff HEAD (compares a (c)ommit and t he (w)ork tree) 122 { 'a' : 'c', 'b' : 'w' }, # git-diff HEAD (compares a (c)ommit and t he (w)ork tree)
123 { 'a' : 'c', 'b' : 'i' }, # git diff --cached (compares a (c)ommit a nd the (i)ndex) 123 { 'a' : 'c', 'b' : 'i' }, # git diff --cached (compares a (c)ommit a nd the (i)ndex)
124 { 'a' : 'o', 'b' : 'w' }, # git-diff HEAD:file1 file2 (compares an ( o)bject and a (w)ork tree entity) 124 { 'a' : 'o', 'b' : 'w' }, # git-diff HEAD:file1 file2 (compares an ( o)bject and a (w)ork tree entity)
125 { 'a' : '1', 'b' : '2' }, # git diff --no-index a b (compares two no n-git things (1) and (2)) 125 { 'a' : '1', 'b' : '2' }, # git diff --no-index a b (compares two no n-git things (1) and (2))
126 ] 126 ]
127 127
128 for prefix in prefixes: 128 for prefix in prefixes:
129 patch = p.sub(lambda x: " %s/" % prefix[x.group(1)], DIFF_TEST_DATA) 129 patch = p.sub(lambda x: " %s/" % prefix[x.group(1)], DIFF_TEST_DATA)
130 self.test_diff_parser(diff_parser.DiffParser(patch.splitlines())) 130 self.test_diff_parser(diff_parser.DiffParser(patch.splitlines()))
131 131
132 def test_git_diff_to_svn_diff(self): 132 def test_git_diff_to_svn_diff(self):
133 output = """\ 133 output = """\
134 Index: Tools/Scripts/webkitpy/common/checkout/diff_parser.py 134 Index: tools/webkitpy/common/checkout/diff_parser.py
135 =================================================================== 135 ===================================================================
136 --- Tools/Scripts/webkitpy/common/checkout/diff_parser.py 136 --- tools/webkitpy/common/checkout/diff_parser.py
137 +++ Tools/Scripts/webkitpy/common/checkout/diff_parser.py 137 +++ tools/webkitpy/common/checkout/diff_parser.py
138 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line): 138 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):
139 A 139 A
140 B 140 B
141 C 141 C
142 +D 142 +D
143 E 143 E
144 F 144 F
145 """ 145 """
146 146
147 inputfmt = StringIO.StringIO("""\ 147 inputfmt = StringIO.StringIO("""\
148 diff --git a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py b/Tools/Scrip ts/webkitpy/common/checkout/diff_parser.py 148 diff --git a/tools/webkitpy/common/checkout/diff_parser.py b/tools/webkitpy/comm on/checkout/diff_parser.py
149 index 2ed552c4555db72df16b212547f2c125ae301a04..72870482000c0dba64ce4300ed782c03 ee79b74f 100644 149 index 2ed552c4555db72df16b212547f2c125ae301a04..72870482000c0dba64ce4300ed782c03 ee79b74f 100644
150 --- a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py 150 --- a/tools/webkitpy/common/checkout/diff_parser.py
151 +++ b/Tools/Scripts/webkitpy/common/checkout/diff_parser.py 151 +++ b/tools/webkitpy/common/checkout/diff_parser.py
152 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line): 152 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):
153 A 153 A
154 B 154 B
155 C 155 C
156 +D 156 +D
157 E 157 E
158 F 158 F
159 """) 159 """)
160 shortfmt = StringIO.StringIO("""\ 160 shortfmt = StringIO.StringIO("""\
161 diff --git a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py b/Tools/Scrip ts/webkitpy/common/checkout/diff_parser.py 161 diff --git a/tools/webkitpy/common/checkout/diff_parser.py b/tools/webkitpy/comm on/checkout/diff_parser.py
162 index b48b162..f300960 100644 162 index b48b162..f300960 100644
163 --- a/Tools/Scripts/webkitpy/common/checkout/diff_parser.py 163 --- a/tools/webkitpy/common/checkout/diff_parser.py
164 +++ b/Tools/Scripts/webkitpy/common/checkout/diff_parser.py 164 +++ b/tools/webkitpy/common/checkout/diff_parser.py
165 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line): 165 @@ -59,6 +59,7 @@ def git_diff_to_svn_diff(line):
166 A 166 A
167 B 167 B
168 C 168 C
169 +D 169 +D
170 E 170 E
171 F 171 F
172 """) 172 """)
173 173
174 self.assertMultiLineEqual(output, ''.join(diff_parser.git_diff_to_svn_di ff(x) for x in shortfmt.readlines())) 174 self.assertMultiLineEqual(output, ''.join(diff_parser.git_diff_to_svn_di ff(x) for x in shortfmt.readlines()))
175 self.assertMultiLineEqual(output, ''.join(diff_parser.git_diff_to_svn_di ff(x) for x in inputfmt.readlines())) 175 self.assertMultiLineEqual(output, ''.join(diff_parser.git_diff_to_svn_di ff(x) for x in inputfmt.readlines()))
OLDNEW
« no previous file with comments | « no previous file | sky/tools/webkitpy/common/checkout/scm/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698