OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Test variable expansion of '<|(list.txt ...)' syntax commands. | 8 Test variable expansion of '<|(list.txt ...)' syntax commands. |
9 """ | 9 """ |
10 | 10 |
| 11 from __future__ import print_function |
| 12 |
11 import os | 13 import os |
12 import sys | 14 import sys |
13 | 15 |
14 import TestGyp | 16 import TestGyp |
15 | 17 |
16 test = TestGyp.TestGyp(format='gypd') | 18 test = TestGyp.TestGyp(format='gypd') |
17 | 19 |
18 expect = test.read('filelist.gyp.stdout') | 20 expect = test.read('filelist.gyp.stdout') |
19 if sys.platform == 'win32': | 21 if sys.platform == 'win32': |
20 expect = expect.replace('/', r'\\').replace('\r\n', '\n') | 22 expect = expect.replace('/', r'\\').replace('\r\n', '\n') |
21 | 23 |
22 test.run_gyp('src/filelist.gyp', | 24 test.run_gyp('src/filelist.gyp', |
23 '--debug', 'variables', | 25 '--debug', 'variables', |
24 stdout=expect, ignore_line_numbers=True) | 26 stdout=expect, ignore_line_numbers=True) |
25 | 27 |
26 # Verify the filelist.gypd against the checked-in expected contents. | 28 # Verify the filelist.gypd against the checked-in expected contents. |
27 # | 29 # |
28 # Normally, we should canonicalize line endings in the expected | 30 # Normally, we should canonicalize line endings in the expected |
29 # contents file setting the Subversion svn:eol-style to native, | 31 # contents file setting the Subversion svn:eol-style to native, |
30 # but that would still fail if multiple systems are sharing a single | 32 # but that would still fail if multiple systems are sharing a single |
31 # workspace on a network-mounted file system. Consequently, we | 33 # workspace on a network-mounted file system. Consequently, we |
32 # massage the Windows line endings ('\r\n') in the output to the | 34 # massage the Windows line endings ('\r\n') in the output to the |
33 # checked-in UNIX endings ('\n'). | 35 # checked-in UNIX endings ('\n'). |
34 | 36 |
35 contents = test.read('src/filelist.gypd').replace( | 37 contents = test.read('src/filelist.gypd').replace( |
36 '\r', '').replace('\\\\', '/') | 38 '\r', '').replace('\\\\', '/') |
37 expect = test.read('filelist.gypd.golden').replace('\r', '') | 39 expect = test.read('filelist.gypd.golden').replace('\r', '') |
38 if not test.match(contents, expect): | 40 if not test.match(contents, expect): |
39 print "Unexpected contents of `src/filelist.gypd'" | 41 print("Unexpected contents of `src/filelist.gypd'") |
40 test.diff(expect, contents, 'src/filelist.gypd ') | 42 test.diff(expect, contents, 'src/filelist.gypd ') |
41 test.fail_test() | 43 test.fail_test() |
42 | 44 |
43 contents = test.read('src/names.txt') | 45 contents = test.read('src/names.txt') |
44 expect = 'John\nJacob\nJingleheimer\nSchmidt\n' | 46 expect = 'John\nJacob\nJingleheimer\nSchmidt\n' |
45 if not test.match(contents, expect): | 47 if not test.match(contents, expect): |
46 print "Unexpected contents of `src/names.txt'" | 48 print("Unexpected contents of `src/names.txt'") |
47 test.diff(expect, contents, 'src/names.txt ') | 49 test.diff(expect, contents, 'src/names.txt ') |
48 test.fail_test() | 50 test.fail_test() |
49 | 51 |
50 test.pass_test() | 52 test.pass_test() |
51 | 53 |
OLD | NEW |