test_dofile.lua 646 B

123456789101112131415161718192021222324252627282930313233343536
  1. --
  2. -- tests/test_dofile.lua
  3. -- Automated test suite for the extended dofile() functions.
  4. -- Copyright (c) 2008 Jason Perkins and the Premake project
  5. --
  6. T.dofile = { }
  7. local os_getenv
  8. function T.dofile.setup()
  9. os_getenv = os.getenv
  10. end
  11. function T.dofile.teardown()
  12. os.getenv = os_getenv
  13. end
  14. --
  15. -- dofile() tests
  16. --
  17. function T.dofile.SearchesPath()
  18. os.getenv = function() return os.getcwd().."/folder" end
  19. result = dofile("ok.lua")
  20. test.isequal("ok", result)
  21. end
  22. function T.dofile.SearchesScriptsOption()
  23. _OPTIONS["scripts"] = os.getcwd().."/folder"
  24. result = dofile("ok.lua")
  25. test.isequal("ok", result)
  26. end