diff options
| author | George Roman <george.roman.99@gmail.com> | 2018-05-29 12:21:02 +0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-29 09:22:03 -0300 |
| commit | a5305f659c159173002b0a2d393021dadc25fc8f (patch) | |
| tree | fb94c0786bed87dcacfbb1b14ca1e533ec385d14 | |
| parent | 27ae57f6140cb8c136c74c38d415afdcadb58ddd (diff) | |
| download | luarocks-a5305f659c159173002b0a2d393021dadc25fc8f.tar.gz luarocks-a5305f659c159173002b0a2d393021dadc25fc8f.tar.bz2 luarocks-a5305f659c159173002b0a2d393021dadc25fc8f.zip | |
Add temporary path utility function to test_env
| -rw-r--r-- | spec/util/test_env.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index b3b9bb77..08d5c850 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
| @@ -88,6 +88,15 @@ function test_env.copy(source, destination) | |||
| 88 | r_destination:close() | 88 | r_destination:close() |
| 89 | end | 89 | end |
| 90 | 90 | ||
| 91 | function test_env.get_tmp_path() | ||
| 92 | local path = os.tmpname() | ||
| 93 | if test_env.TEST_TARGET_OS == "windows" and not path:find(":") then | ||
| 94 | path = os.getenv("TEMP") .. path | ||
| 95 | end | ||
| 96 | os.remove(path) | ||
| 97 | return path | ||
| 98 | end | ||
| 99 | |||
| 91 | --- Helper function for execute_bool and execute_output | 100 | --- Helper function for execute_bool and execute_output |
| 92 | -- @param command string: command to execute | 101 | -- @param command string: command to execute |
| 93 | -- @param print_command boolean: print command if 'true' | 102 | -- @param print_command boolean: print command if 'true' |
