Mercurial > hg > octave-shane
changeset 13072:39814ef3278b
codesprint: Add tests for tempdir
* tempdir.m: Add tests for tempdir
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 03 Sep 2011 12:44:15 -0700 |
parents | a3d21c3c0f58 |
children | 51bc892d5cf8 |
files | scripts/miscellaneous/tempdir.m |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/tempdir.m +++ b/scripts/miscellaneous/tempdir.m @@ -37,3 +37,19 @@ endif endfunction + + +%!assert (ischar (tempdir ())) + +%!test +%! old_wstate = warning ("query"); +%! warning ("off"); +%! old_tmpdir = getenv ("TMPDIR"); +%! unwind_protect +%! setenv ("TMPDIR", "__MY_TMP_DIR__"); +%! assert (tempdir (), ["__MY_TMP_DIR__" filesep()]); +%! unwind_protect_cleanup +%! setenv ("TMPDIR", old_tmpdir); +%! warning (old_wstate); +%! end_unwind_protect +