OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 """ |
| 8 Test variable expansion of '<|(list.txt ...)' syntax commands. |
| 9 """ |
| 10 |
| 11 import os |
| 12 import sys |
| 13 |
| 14 import TestGyp |
| 15 |
| 16 test = TestGyp.TestGyp(format='gypd') |
| 17 |
| 18 expect = test.read('filelist.gyp.stdout') |
| 19 if sys.platform == 'win32': |
| 20 expect = expect.replace('/', r'\\').replace('\r\n', '\n') |
| 21 |
| 22 test.run_gyp('src/filelist.gyp', |
| 23 '--debug', 'variables', |
| 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' |
| 45 if not test.match(contents, expect): |
| 46 print "Unexpected contents of `src/names.txt'" |
| 47 test.diff(expect, contents, 'src/names.txt ') |
| 48 test.fail_test() |
| 49 |
| 50 test.pass_test() |
| 51 |
OLD | NEW |