1#!/usr/local/bin/python3.8
2
3# Copyright 2003 Vladimir Prus
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7# Test that C files are compiled by a C compiler.
8
9import BoostBuild
10
11t = BoostBuild.Tester(use_test_config=False)
12
13t.write("jamroot.jam", """
14project ;
15exe hello : hello.cpp a.c ;
16""")
17
18t.write("hello.cpp", """
19extern "C" int foo();
20int main() { return foo(); }
21""")
22
23t.write("a.c", """
24// This will not compile unless in C mode.
25int foo()
26{
27    int new = 0;
28    new = (new+1)*7;
29    return new;
30}
31""")
32
33t.run_build_system()
34t.expect_addition("bin/$toolset/debug*/hello.exe")
35
36t.cleanup()
37