mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
refactor: require a hash before relocating a ref
This commit is contained in:
1 parent
5330ed1950
commit
902bb4e01e
6 files changed
+40
-21
No files matched your search
@@ -337,14 +337,18 @@ class TestVerifyAtPin(unittest.TestCase):
|
||||
def test_declared_value_carried_by_another_line(self):
|
||||
lines = ["load()", "", "", "", "", "", 'rom("cafebabe")']
|
||||
part = RefPart("a.c", 1, 1, "a.c:1")
|
||||
result = profile_sync.verify_at_pin(part, lines, ["cafebabe"])
|
||||
result = profile_sync.verify_at_pin(
|
||||
part, lines, ["cafebabe"], ["cafebabe"]
|
||||
)
|
||||
self.assertEqual(result.status, "MOVED")
|
||||
self.assertEqual(result.start, 7)
|
||||
|
||||
def test_declared_value_on_several_lines_is_ambiguous(self):
|
||||
lines = ["load()", "", "", "", 'a("cafebabe")', "", 'b("cafebabe")']
|
||||
part = RefPart("a.c", 1, 1, "a.c:1")
|
||||
result = profile_sync.verify_at_pin(part, lines, ["cafebabe"])
|
||||
result = profile_sync.verify_at_pin(
|
||||
part, lines, ["cafebabe"], ["cafebabe"]
|
||||
)
|
||||
self.assertEqual(result.status, "AMBIGUOUS")
|
||||
|
||||
def test_one_anchored_part_settles_the_others(self):
|
||||
@@ -386,6 +390,13 @@ class TestVerifyAtPin(unittest.TestCase):
|
||||
result = profile_sync.verify_at_pin(part, None, ["cafebabe"])
|
||||
self.assertEqual(result.status, "EXTERNAL")
|
||||
|
||||
def test_a_name_fragment_elsewhere_is_not_evidence(self):
|
||||
# Only a hash is unique enough to prove a ref points elsewhere.
|
||||
lines = ["load()", "", "", "", "", "", "tyrian2.c line"]
|
||||
part = RefPart("a.c", 1, 1, "a.c:1")
|
||||
result = profile_sync.verify_at_pin(part, lines, ["tyrian2"], [])
|
||||
self.assertEqual(result.status, "ANCHORED")
|
||||
|
||||
def test_missing_file(self):
|
||||
part = RefPart("a.c", 1, 1, "a.c:1")
|
||||
self.assertEqual(
|
||||
|
||||
Reference in new issue
Block a user