|
Boost : |
Subject: Re: [boost] [filesystem] temp_dir_path()
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-10-14 15:05:56
Stewart, Robert wrote:
> Jeff Flinn wrote:
>> Stewart, Robert wrote:
>>> Jeff Flinn wrote:
>>> Did you test the various combinations of e-vars being set?
>> Yes, manually(not within operations_test.cpp) on mac by
>> setting/unsetting the environment vars, not on windows though
>> as I've not been able to make GetTempPath to fail. Not sure if
>> mucking with the environ is acceptable to Beman's tests.
>
> I'm assuming that temp_dir_path()'s test code would be in a
> separate executable, so that wouldn't be an issue.
>
>>> How are you testing the error handling code?
>> Same as above. Any thoughts on how to proceed?
>
> Use setenv() and unsetenv() to modify the environment and run the test to verify you get the expected results.
>
> Set each of the e-vars singly, in turn, and test with each.
>
> Set each pair of e-vars, in turn, and verify the results for each.
>
> Etc.
>
> Set just TMPDIR to an invalid, but non-empty, pathname and test for the expected error.
I've attached an updated patch to ticket #4742.
This adds tests to operations_test.cpp that test the error handling for
both returned error code and thrown filesystem_error. Additionally it
tests proper retrieval of the path from the list of env vars for each of
the platforms.
Also, temp_dir_path now also sets the error_code to ENOTDIR upon failure.
These test pass on Windows XP with MSVC8 and Mac OSX10.5.8 with
Xcode3.1.2 using gcc 4.0.1
I'd appreciate it if others could run the tests on other os/compilers as
well.
Thanks, Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk