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 import os | 11 import os |
12 import sys | 12 import sys |
13 | 13 |
14 import TestGyp | 14 import TestGyp |
15 | 15 |
16 test = TestGyp.TestGyp(format='gypd') | 16 test = TestGyp.TestGyp() |
17 | 17 |
18 expect = test.read('filelist.gyp.stdout') | 18 CHDIR = 'src' |
19 if sys.platform == 'win32': | 19 test.run_gyp('filelist2.gyp', chdir=CHDIR) |
20 expect = expect.replace('/', r'\\').replace('\r\n', '\n') | |
21 | 20 |
22 test.run_gyp('src/filelist.gyp', | 21 test.build('filelist2.gyp', 'foo', chdir=CHDIR) |
23 '--debug', 'variables', | 22 contents = test.read('src/dummy_foo').replace('\r', '') |
24 stdout=expect, ignore_line_numbers=True) | |
25 | |
26 # Verify the filelist.gypd against the checked-in expected contents. | |
27 # | |
28 # Normally, we should canonicalize line endings in the expected | |
29 # contents file setting the Subversion svn:eol-style to native, | |
30 # but that would still fail if multiple systems are sharing a single | |
31 # workspace on a network-mounted file system. Consequently, we | |
32 # massage the Windows line endings ('\r\n') in the output to the | |
33 # checked-in UNIX endings ('\n'). | |
34 | |
35 contents = test.read('src/filelist.gypd').replace( | |
36 '\r', '').replace('\\\\', '/') | |
37 expect = test.read('filelist.gypd.golden').replace('\r', '') | |
38 if not test.match(contents, expect): | |
39 print "Unexpected contents of `src/filelist.gypd'" | |
40 test.diff(expect, contents, 'src/filelist.gypd ') | |
41 test.fail_test() | |
42 | |
43 contents = test.read('src/names.txt') | |
44 expect = 'John\nJacob\nJingleheimer\nSchmidt\n' | 23 expect = 'John\nJacob\nJingleheimer\nSchmidt\n' |
45 if not test.match(contents, expect): | 24 if not test.match(contents, expect): |
46 print "Unexpected contents of `src/names.txt'" | 25 print "Unexpected contents of `src/dummy_foo'" |
47 test.diff(expect, contents, 'src/names.txt ') | 26 test.diff(expect, contents, 'src/dummy_foo') |
48 test.fail_test() | 27 test.fail_test() |
49 | |
50 test.pass_test() | |
OLD | NEW |