test_premake.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --
  2. -- tests/test_premake.lua
  3. -- Automated test suite for the Premake support functions.
  4. -- Copyright (c) 2008-2009 Jason Perkins and the Premake project
  5. --
  6. T.premake = { }
  7. --
  8. -- premake.checktools() tests
  9. --
  10. function T.premake.checktools_SetsDefaultTools()
  11. _ACTION = "gmake"
  12. premake.checktools()
  13. test.isequal("gcc", _OPTIONS.cc)
  14. test.isequal("mono", _OPTIONS.dotnet)
  15. end
  16. function T.premake.checktools_Fails_OnToolMismatch()
  17. _ACTION = "gmake"
  18. _OPTIONS["cc"] = "xyz"
  19. ok, err = premake.checktools()
  20. test.isfalse( ok )
  21. test.isequal("the GNU Make action does not support /cc=xyz (yet)", err)
  22. end
  23. --
  24. -- generate() tests
  25. --
  26. function T.premake.generate_OpensCorrectFile()
  27. prj = { name = "MyProject", location = "MyLocation" }
  28. premake.generate(prj, "%%.prj", function () end)
  29. test.openedfile("MyLocation/MyProject.prj")
  30. end
  31. function T.premake.generate_ClosesFile()
  32. prj = { name = "MyProject", location = "MyLocation" }
  33. premake.generate(prj, "%%.prj", function () end)
  34. test.closedfile(true)
  35. end