fix(nid-names): normalize Windows inventory paths

This commit is contained in:
MrMha 2026-10-11 19:30:28 +04:00
parent 08b1b7808a
commit 2f6db82da7
2 changed files with 8 additions and 2 deletions

View File

@ -97,7 +97,7 @@ def collect_unknowns():
for path in source_files(PRX):
text = path.read_text(encoding="utf-8")
for nid, name in source_aliases(text):
found.setdefault(nid, "%s:%s" % (path.relative_to(ROOT), name))
found.setdefault(nid, "%s:%s" % (path.relative_to(ROOT).as_posix(), name))
return found

View File

@ -4,7 +4,7 @@ import json
import tempfile
import sys
import unittest
from pathlib import Path
from pathlib import Path, PureWindowsPath
from unittest.mock import patch
from urllib.error import URLError
@ -161,6 +161,12 @@ int APS5_VABI sceReal() { return 0; }
self.write_source('APS5_EXPORT (\n "AAAAAAAAAAA" ,\n exampleUnknown00\n );\n')
self.assertEqual(nid_names.collect_unknowns(), {"AAAAAAAAAAA": "core/libs/prx/libSceExample/Export.cpp:exampleUnknown00"})
def test_windows_source_paths_use_portable_separators(self):
self.write_source('APS5_EXPORT("AAAAAAAAAAA", exampleUnknown00);\n')
relative = PureWindowsPath("core/libs/prx/libSceExample/Export.cpp")
with patch.object(Path, "relative_to", return_value=relative):
self.assertEqual(nid_names.collect_unknowns(), {"AAAAAAAAAAA": "core/libs/prx/libSceExample/Export.cpp:exampleUnknown00"})
def test_test_fixtures_are_not_runtime_implementations(self):
self.write_source('APS5_EXPORT("AAAAAAAAAAA", exampleUnknown00);\nint APS5_VABI sceFixture() { return 0; }\n', "tests/Fixture.cpp")
self.assertEqual(nid_names.collect_unknowns(), {})