/Src/Dependencies/Boost/tools/build/v2/test/c_file.py

http://hadesmem.googlecode.com/ · Python · 36 lines · 22 code · 9 blank · 5 comment · 0 complexity · 4210b68b1de900283e735175f1c2af1c MD5 · raw file

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