test_config.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. --
  2. -- tests/test_config.lua
  3. -- Automated test suite for the configuration handling functions.
  4. -- Copyright (c) 2010 Jason Perkins and the Premake project
  5. --
  6. T.config = { }
  7. local suite = T.config
  8. --
  9. -- Setup/Teardown
  10. --
  11. function suite.setup()
  12. sln = test.createsolution()
  13. end
  14. local cfg
  15. local function prepare()
  16. premake.bake.buildconfigs()
  17. cfg = premake.solution.getproject(sln, 1)
  18. end
  19. --
  20. -- Debug/Release build testing
  21. --
  22. function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseFlag()
  23. flags { "Optimise" }
  24. prepare()
  25. return test.isfalse(premake.config.isdebugbuild(cfg))
  26. end
  27. function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseSizeFlag()
  28. flags { "OptimiseSize" }
  29. prepare()
  30. return test.isfalse(premake.config.isdebugbuild(cfg))
  31. end
  32. function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseSpeedFlag()
  33. flags { "OptimiseSpeed" }
  34. prepare()
  35. return test.isfalse(premake.config.isdebugbuild(cfg))
  36. end
  37. function suite.IsDebug_ReturnsFalse_OnOptimizeFlag()
  38. flags { "Optimize" }
  39. prepare()
  40. return test.isfalse(premake.config.isdebugbuild(cfg))
  41. end
  42. function suite.IsDebug_ReturnsFalse_OnOptimizeSizeFlag()
  43. flags { "OptimizeSize" }
  44. prepare()
  45. return test.isfalse(premake.config.isdebugbuild(cfg))
  46. end
  47. function suite.IsDebug_ReturnsFalse_OnOptimizeSpeedFlag()
  48. flags { "OptimizeSpeed" }
  49. prepare()
  50. return test.isfalse(premake.config.isdebugbuild(cfg))
  51. end
  52. function suite.IsDebug_ReturnsFalse_OnNoSymbolsFlag()
  53. prepare()
  54. return test.isfalse(premake.config.isdebugbuild(cfg))
  55. end
  56. function suite.IsDebug_ReturnsTrue_OnSymbolsFlag()
  57. flags { "Symbols" }
  58. prepare()
  59. return test.istrue(premake.config.isdebugbuild(cfg))
  60. end
  61. function suite.shouldIncrementallyLink_staticLib_returnsFalse()
  62. kind "StaticLib"
  63. prepare()
  64. return test.isfalse(premake.config.isincrementallink(cfg))
  65. end
  66. function suite.shouldIncrementallyLink_optimizeFlagSet_returnsFalse()
  67. flags { "Optimize" }
  68. prepare()
  69. return test.isfalse(premake.config.isincrementallink(cfg))
  70. end
  71. function suite.shouldIncrementallyLink_NoIncrementalLinkFlag_returnsFalse()
  72. flags { "NoIncrementalLink" }
  73. prepare()
  74. return test.isfalse(premake.config.isincrementallink(cfg))
  75. end
  76. function suite.shouldIncrementallyLink_notStaticLib_NoIncrementalLinkFlag_noOptimiseFlag_returnsTrue()
  77. prepare()
  78. return test.istrue(premake.config.isincrementallink(cfg))
  79. end