blob: 55eaf9db46b3b4c20f6ca889bc258ec2585fa294 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001#!/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"""
8Test variable expansion of '<|(list.txt ...)' syntax commands.
9"""
10
11import os
12import sys
13
14import TestGyp
15
16test = TestGyp.TestGyp(format='gypd')
17
18expect = test.read('filelist.gyp.stdout')
19if sys.platform == 'win32':
20 expect = expect.replace('/', r'\\').replace('\r\n', '\n')
21
22test.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
35contents = test.read('src/filelist.gypd').replace(
36 '\r', '').replace('\\\\', '/')
37expect = test.read('filelist.gypd.golden').replace('\r', '')
38if 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
43contents = test.read('src/names.txt')
44expect = 'John\nJacob\nJingleheimer\nSchmidt\n'
45if 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
50test.pass_test()
51