New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand file tests #342
Expand file tests #342
Conversation
S32-io/file-tests.t
Outdated
| $fh.close(); | ||
| } | ||
|
|
||
| { # Create a symlink to an existing file | ||
| symlink(%tempfiles<existing>, %tempfiles<symlink-existing>); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating all of these manually in the current dir and then manually cleaning them up, you should add to the top of the file (after use v6):
use lib <t/spec/packages/>;
use Test::Util;And that will give you make-temp-file and make-temp-dir routines. make-temp-file without :content(...) argument creates just a temp path so you could use that for non-existing file too. Alternatively, you can just chdir to a make-temp-dir'ed dir and create all of these files up in there.
This way the test file will cut down on setup code all of these files aren't left hanging around in the current dir if the spectest is interrupted.
|
👍 Thanks! FWIW, tests like this one: nok %tempfiles<rw>.IO.rwx, 'File with rw- is not readable, writable and executable';
isa-ok %tempfiles<rw>.IO.rwx, Bool, '.rwx returns Bool';Can be written as just: is-deeply %tempfiles<rw>.IO.rwx, False, 'File with rw- is not readable, writable and executable';It'll check the actual return value matches what you expected (so here, it's |
This PR intends to expand the tests in
S32-io/file-tests.t, as referenced in #118.