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
9Make sure the program in a command can be a called batch file, or an
10application in the path. Specifically, this means not quoting something like
11"call x.bat", lest the shell look for a program named "call x.bat", rather
12than calling "x.bat".
13"""
14
15import TestGyp
16
17import sys
18
19if sys.platform == 'win32':
20  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
21  CHDIR = 'command-quote'
22  test.run_gyp('command-quote.gyp', chdir=CHDIR)
23
24  test.build('command-quote.gyp', 'test_batch', chdir=CHDIR)
25  test.build('command-quote.gyp', 'test_call_separate', chdir=CHDIR)
26  test.build('command-quote.gyp', 'test_with_double_quotes', chdir=CHDIR)
27  test.build('command-quote.gyp', 'test_with_single_quotes', chdir=CHDIR)
28
29  # We confirm that this fails because other generators don't handle spaces in
30  # inputs so it's preferable to not have it work here.
31  test.build('command-quote.gyp', 'test_with_spaces', chdir=CHDIR, status=1)
32
33  CHDIR = 'command-quote/subdir/and/another'
34  test.run_gyp('in-subdir.gyp', chdir=CHDIR)
35  test.build('in-subdir.gyp', 'test_batch_depth', chdir=CHDIR)
36
37  test.pass_test()
38