Skip to content
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

Merged
merged 20 commits into from Oct 7, 2017
Merged

Expand file tests #342

merged 20 commits into from Oct 7, 2017

Conversation

Tyil
Copy link
Member

@Tyil Tyil commented Oct 7, 2017

This PR intends to expand the tests in S32-io/file-tests.t, as referenced in #118.

$fh.close();
}

{ # Create a symlink to an existing file
symlink(%tempfiles<existing>, %tempfiles<symlink-existing>);
}
Copy link
Contributor

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.

@Tyil Tyil changed the title WIP: Expand file tests Expand file tests Oct 7, 2017
@zoffixznet zoffixznet merged commit 4f224ec into Raku:master Oct 7, 2017
@zoffixznet
Copy link
Contributor

zoffixznet commented Oct 7, 2017

👍 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 False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants