Patchwork D5643: fuzz: exercise more of the lazymanifest code

login
register
mail settings
Submitter phabricator
Date Jan. 23, 2019, 5:46 a.m.
Message ID <c06514dd706cf0f2ad85b3f2ca42c9c4@localhost.localdomain>
Download mbox | patch
Permalink /patch/37917/
State Not Applicable
Headers show

Comments

phabricator - Jan. 23, 2019, 5:46 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd60bd5c71cbb: fuzz: exercise more of the lazymanifest code (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5643?vs=13339&id=13356

REVISION DETAIL
  https://phab.mercurial-scm.org/D5643

AFFECTED FILES
  contrib/fuzz/manifest.cc

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/fuzz/manifest.cc b/contrib/fuzz/manifest.cc
--- a/contrib/fuzz/manifest.cc
+++ b/contrib/fuzz/manifest.cc
@@ -20,11 +20,19 @@ 
   lm = lazymanifest(mdata)
   # iterate the whole thing, which causes the code to fully parse
   # every line in the manifest
-  list(lm.iterentries())
+  for e, _, _ in lm.iterentries():
+      # also exercise __getitem__ et al
+      lm[e]
+      e in lm
+      (e + 'nope') in lm
   lm[b'xyzzy'] = (b'\0' * 20, 'x')
   # do an insert, text should change
   assert lm.text() != mdata, "insert should change text and didn't: %r %r" % (lm.text(), mdata)
+  cloned = lm.filtercopy(lambda x: x != 'xyzzy')
+  assert cloned.text() == mdata, 'cloned text should equal mdata'
+  cloned.diff(lm)
   del lm[b'xyzzy']
+  cloned.diff(lm)
   # should be back to the same
   assert lm.text() == mdata, "delete should have restored text but didn't: %r %r" % (lm.text(), mdata)
 except Exception as e: