mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-03 12:57:27 +00:00
exports() only checked whether the matching line ended with a semicolon, so a prototype wrapped over several lines was counted as an implemented export and two PRs adding the same forward declaration were flagged as overlapping. It now joins the following added lines up to the first semicolon or brace and treats the match as a declaration when the semicolon comes first. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01V9UU71SP1UKGR51Sowbgmq
29 lines
952 B
Python
29 lines
952 B
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
import pr_overlap
|
|
|
|
DECL = "+int APS5_VABI sceFooBar(int a,\n+ int b);\n"
|
|
|
|
|
|
class WrappedExportTests(unittest.TestCase):
|
|
def test_wrapped_declaration_is_not_export(self):
|
|
self.assertEqual(pr_overlap.exports(DECL), set())
|
|
|
|
def test_wrapped_definition_is_export(self):
|
|
diff = "+int APS5_VABI sceFooBar(int a,\n+ int b) {\n+ return a + b;\n+}\n"
|
|
self.assertEqual(pr_overlap.exports(diff), {"sceFooBar"})
|
|
|
|
def test_declaration_then_definition_returns_only_definition(self):
|
|
diff = DECL + "+int APS5_VABI sceBaz(int a) { return a; }\n"
|
|
self.assertEqual(pr_overlap.exports(diff), {"sceBaz"})
|
|
|
|
def test_declaration_at_end_of_diff(self):
|
|
self.assertEqual(pr_overlap.exports("+int APS5_VABI sceFooBar(int a, int b);"), set())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|