unit_test.py 722 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/python
  2. # Copyright 2003, 2004 Vladimir Prus
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. # Test the unit_test rule.
  6. import BoostBuild
  7. t = BoostBuild.Tester(use_test_config=False)
  8. # Create the needed files.
  9. t.write("jamroot.jam", """
  10. using testing ;
  11. lib helper : helper.cpp ;
  12. unit-test test : test.cpp : <library>helper ;
  13. """)
  14. t.write("test.cpp", """
  15. void helper();
  16. int main() { helper(); }
  17. """)
  18. t.write("helper.cpp", """
  19. void
  20. #if defined(_WIN32)
  21. __declspec(dllexport)
  22. #endif
  23. helper() {}
  24. """)
  25. t.run_build_system(["link=static"])
  26. t.expect_addition("bin/$toolset/debug/link-static*/test.passed")
  27. t.cleanup()