add tests for file module predicates

reproduce failing `directory_exists/1` with working directory passed as first argument
reproduce failing `delete_directory/1` with ./test directory passed as first argument
reproduce failing `file_size/1` with 2 bytes files passed as first argument
reproduce failing `file_exists/1` with existing file passed as first argument
reproduce failing `file_modification_time/1`, `file_access_time/1` and `file_creation_time/1` with existing file passed as first argument
reproduce failing `directory_files/2` with existing directory passed as first argument
reproduce failing `delete_file/1` with existing file passed as first argument
reproduce failing `make_directory/1` with non-existing directory passed as first argument
reproduce failing `make_directory_path/1` with non-existing path passed as first argument
reproduce failing `path_canonical/2` with non-canonical path passed as first argument
reproduce failing `rename_file/2` with existing file passed as first argument, target file as second arg
revised `directory_exists/1` test case
renamed test files, test directories
use `path_segments/2`, remove path separators
do not write file size to current output
revised `directory_files/2` test
revised `path_canonical/2` test
revised `file_exists/1` test
removed hardcoded expected size
extracted hardcoded directory argument
remove path prefix containing path separator
revised expected ls cmd exit code so that it is platform-agnostic

Signed-off-by: Thierry Marianne <thierry@marianne.io>
This commit is contained in:
Thierry Marianne
2025-09-19 22:40:45 +02:00
parent e9ff1348b1
commit 12db664bd9
13 changed files with 422 additions and 0 deletions

View File

@@ -52,6 +52,90 @@ fn issue2725_dcg_without_module() {
load_module_test("tests-pl/issue2725.pl", "");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_delete_directory() {
load_module_test("tests-pl/issue_delete_directory.pl", "directory_deleted");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_delete_file() {
load_module_test("tests-pl/issue_delete_file.pl", "file_deleted");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_directory_exists() {
load_module_test("tests-pl/issue_directory_exists.pl", "");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_directory_files() {
load_module_test("tests-pl/issue_directory_files.pl", "1");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_file_copy() {
load_module_test("tests-pl/issue_file_copy.pl", "file_copied");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_file_exists() {
load_module_test("tests-pl/issue_file_exists.pl", "");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_file_size() {
load_module_test("tests-pl/issue_file_size.pl", "");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_file_time() {
load_module_test("tests-pl/issue_file_time.pl", "");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_make_directory() {
load_module_test("tests-pl/issue_make_directory.pl", "directory_made");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_make_directory_path() {
load_module_test("tests-pl/issue_make_directory_path.pl", "directory_path_made");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_path_canonical() {
load_module_test("tests-pl/issue_path_canonical.pl", "path_canonicalized");
}
#[serial]
#[test]
#[cfg_attr(miri, ignore = "it takes too long to run")]
fn issue_rename_file() {
load_module_test("tests-pl/issue_rename_file.pl", "file_renamed");
}
#[test]
#[cfg(feature = "http")]
#[cfg(not(target_arch = "wasm32"))]