test_dotnet.lua 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --
  2. -- tests/tools/test_dotnet.lua
  3. -- Automated test suite for the .NET toolset interface.
  4. -- Copyright (c) 2012-2013 Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. local suite = test.declare("tools_dotnet")
  8. local dotnet = p.tools.dotnet
  9. --
  10. -- Setup/teardown
  11. --
  12. local wks, prj, cfg
  13. function suite.setup()
  14. wks, prj = test.createWorkspace()
  15. end
  16. local function prepare()
  17. cfg = test.getconfig(prj, "Debug")
  18. end
  19. --
  20. -- On Windows, use Microsoft's CSC compiler by default.
  21. --
  22. function suite.defaultCompiler_onWindows()
  23. _TARGET_OS = "windows"
  24. prepare()
  25. test.isequal("csc", dotnet.gettoolname(cfg, "csc"))
  26. end
  27. --
  28. -- Everywhere other than Windows, use Mono by default.
  29. --
  30. function suite.defaultCompiler_onMacOSX()
  31. _TARGET_OS = "macosx"
  32. prepare()
  33. test.isequal("csc", dotnet.gettoolname(cfg, "csc"))
  34. end
  35. --
  36. -- Check support for the `csversion` API
  37. --
  38. function suite.flags_csversion()
  39. prepare()
  40. csversion "7.2"
  41. test.contains({ "/langversion:7.2" }, dotnet.getflags(cfg))
  42. end