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"""
8Test variable expansion of '<!()' syntax commands where they are evaluated
9more then once..
10"""
11
12import TestGyp
13
14test = TestGyp.TestGyp(format='gypd')
15
16expect = test.read('commands-repeated.gyp.stdout').replace('\r\n', '\n')
17
18test.run_gyp('commands-repeated.gyp',
19             '--debug', 'variables',
20             stdout=expect, ignore_line_numbers=True)
21
22# Verify the commands-repeated.gypd against the checked-in expected contents.
23#
24# Normally, we should canonicalize line endings in the expected
25# contents file setting the Subversion svn:eol-style to native,
26# but that would still fail if multiple systems are sharing a single
27# workspace on a network-mounted file system.  Consequently, we
28# massage the Windows line endings ('\r\n') in the output to the
29# checked-in UNIX endings ('\n').
30
31contents = test.read('commands-repeated.gypd').replace('\r\n', '\n')
32expect = test.read('commands-repeated.gypd.golden').replace('\r\n', '\n')
33if not test.match(contents, expect):
34  print "Unexpected contents of `commands-repeated.gypd'"
35  test.diff(expect, contents, 'commands-repeated.gypd ')
36  test.fail_test()
37
38test.pass_test()
39