Mercurial > hg > octave-avbm
diff scripts/miscellaneous/tempdir.m @ 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 | fd0a3ac60b0e |
children | e81ddf9cacd5 |
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 +