test_project.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --
  2. -- tests/test_project.lua
  3. -- Automated test suite for the project support functions.
  4. -- Copyright (c) 2008-2010 Jason Perkins and the Premake project
  5. --
  6. local _project = premake.project
  7. T.project = { }
  8. local cfg, result
  9. function T.project.setup()
  10. _ACTION = "gmake"
  11. cfg = {}
  12. cfg.project = {}
  13. cfg.language = "C++"
  14. cfg.files = {}
  15. cfg.trimpaths = {}
  16. cfg.platform = "Native"
  17. result = "\n"
  18. end
  19. --
  20. -- findproject() tests
  21. --
  22. function T.project.findproject_IsCaseSensitive()
  23. local sln = test.createsolution()
  24. local prj = test.createproject(sln)
  25. premake.bake.buildconfigs()
  26. test.isnil(premake.findproject("myproject"))
  27. end
  28. --
  29. -- getfilename() tests
  30. --
  31. function T.project.getfilename_ReturnsRelativePath()
  32. local prj = { name = "project", location = "location" }
  33. local r = _project.getfilename(prj, path.join(os.getcwd(), "../filename"))
  34. test.isequal("../filename", r)
  35. end
  36. function T.project.getfilename_PerformsSubstitutions()
  37. local prj = { name = "project", location = "location" }
  38. local r = _project.getfilename(prj, "%%.prj")
  39. test.isequal("location/project.prj", r)
  40. end
  41. --
  42. -- premake.getlinks() tests
  43. --
  44. function T.project.getlinks_OnMscSystemLibs()
  45. _OPTIONS.cc = "msc"
  46. cfg.links = { "user32", "gdi32" }
  47. result = premake.getlinks(cfg, "all", "fullpath")
  48. test.isequal("user32.lib gdi32.lib", table.concat(result, " "))
  49. end