neovim/neovim — pull request #1617 by stevenyvr987 (2014-12-05 21:41:30+00:00)
Title: Unit test tempfile - add more test cases

The two commits in this PR originates as a followup to issue #1432. I wanted to add a test case or two to detect the issue. In the act of doing this, I realize a few more test cases of a similar nature could be added. Also, I added a test to directly verify temp directory deletion.

The new test cases are mostly concerned with testing two successive calls of gettempdir or tempname, and when the calls are interrupted by deleting the temp directory, or by doing the other operation. For example,

1. gettempdir, gettempdir
2. gettempdir, deltempdir, gettempdir - 'internally' delete temp directory
3. gettempdir, lfs.rmdir, gettempdir - 'externally' delete temp directory
4. gettempdir, tempname, gettempdir

Test case 1 appears in the original unit test, which is a check for idempotency.
Test case 4 checks for any side effects between gettempdir and tempname.
Test case 3 checks for #1432 and is to be compared with test case 2. Test case 3 is written to succeed, although it should more naturally fail, if it wasn't for the performance hit that will occur (see comments in #1432).

A similar test sequence is repeated for tempname.

Roughly speaking, the first commit re-expresses the original unit test with shortcut aliases so there is less verbosity. The first commit also merges two of the test cases into one. The second commit adds the extra test cases.