upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/file_system_test.cpp
diff options
context:
space:
mode:
authorkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 21:39:04 +0000
committerkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 22:05:06 +0000
commitf46e90310df7ecdcd414f4b3a1afa31e35272d5e (patch)
tree445daa299e90f1b43e4f4e8894656c821018e0e5 /runtime/test/file_system_test.cpp
parent95f023f62b1fb5c28d88cfbc176de3d6a0c4de17 (diff)
file_system: a listing directly below a file is ERROR_DIRECTORY, as on the host
collect answered ERROR_PATH_NOT_FOUND for any folder that is not one in the title's view. The host tells a missing folder (3) from a file in the folder's place (267); view() already knows which. Reported in review by shdann, with the host table. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/file_system_test.cpp')
-rw-r--r--runtime/test/file_system_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp
index 9d7ba1695..4274b0333 100644
--- a/runtime/test/file_system_test.cpp
+++ b/runtime/test/file_system_test.cpp
@@ -7,6 +7,7 @@
7 7
8#include <cstdio> 8#include <cstdio>
9#include <filesystem> 9#include <filesystem>
10#include <initializer_list>
10#include <string> 11#include <string>
11#include <thread> 12#include <thread>
12#include <vector> 13#include <vector>
@@ -783,6 +784,22 @@ int main() {
783 if (h != INVALID_HANDLE_VALUE) find_close(h); 784 if (h != INVALID_HANDLE_VALUE) find_close(h);
784 check(list(first_w, next_w, find_close, L"GAME:\\listing\\*").size() == 2, 785 check(list(first_w, next_w, find_close, L"GAME:\\listing\\*").size() == 2,
785 "and the emptied parent lists only . and .."); 786 "and the emptied parent lists only . and ..");
787
788 // A listing whose folder is a file is neither: the host answers ERROR_DIRECTORY. One level further down the
789 // path is simply missing again. (Case measured on the host and reported in review by shdann.)
790 write_path(package / "listing" / "file.txt", "package");
791 for (const wchar_t* pattern : {L"GAME:\\listing\\file.txt\\*", L"GAME:\\listing\\file.txt\\x"}) {
792 SetLastError(0);
793 h = first_w(pattern, &found);
794 check(h == INVALID_HANDLE_VALUE && GetLastError() == ERROR_DIRECTORY,
795 "FindFirstFileW below a file fails with ERROR_DIRECTORY, as the host does");
796 if (h != INVALID_HANDLE_VALUE) find_close(h);
797 }
798 SetLastError(0);
799 h = first_w(L"GAME:\\listing\\file.txt\\sub\\*", &found);
800 check(h == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
801 "and two levels below a file with ERROR_PATH_NOT_FOUND");
802 if (h != INVALID_HANDLE_VALUE) find_close(h);
786 } 803 }
787 804
788 // A move onto the same name succeeds and changes nothing; a rename that changes only the case renames. 805 // A move onto the same name succeeds and changes nothing; a rename that changes only the case renames.