test_option.lua 921 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --
  2. -- tests/base/test_option.lua
  3. -- Verify the handling of command line options and the _OPTIONS table.
  4. -- Copyright (c) 2014 Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. local suite = test.declare("base_option")
  8. --
  9. -- Setup and teardown.
  10. --
  11. function suite.setup()
  12. _OPTIONS["testopt"] = "testopt"
  13. end
  14. function suite.teardown()
  15. _OPTIONS["testopt"] = nil
  16. end
  17. --
  18. -- Because we can't control how the user will type in options on the
  19. -- command line, all key lookups should be case insensitive.
  20. --
  21. function suite.returnsCorrectOption_onMixedCase()
  22. test.isnotnil(_OPTIONS["TestOpt"])
  23. end
  24. --
  25. -- Because we can't control how the user will type in options in the
  26. -- premake script, keys should be stored in lowercase.
  27. --
  28. function suite.storesOptionCorrectly_onMixedCase()
  29. newoption {
  30. trigger = "TestOpt2",
  31. description = "Testing",
  32. }
  33. test.isnotnil(p.option.get("testopt2"))
  34. end