From patchwork Thu Feb 25 13:58:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,5,V6] testing: expand Hypothesis tests with branch commands From: David MacIver X-Patchwork-Id: 13383 Message-Id: <2c78c4ca03846861494a.1456408725@laser-shark> To: mercurial-devel@mercurial-scm.org Date: Thu, 25 Feb 2016 13:58:45 +0000 # HG changeset patch # User David R. MacIver # Date 1456319203 0 # Wed Feb 24 13:06:43 2016 +0000 # Node ID 2c78c4ca03846861494a72471a30e6fb4cfea911 # Parent 9faac772da8a8f83008706da0b6168ead1396b5d testing: expand Hypothesis tests with branch commands This builds on the previous work to add Hypothesis based stateful testing to add branching commands to the model. diff -r 9faac772da8a -r 2c78c4ca0384 tests/test-verify-repo-operations.py --- a/tests/test-verify-repo-operations.py Wed Feb 24 13:05:45 2016 +0000 +++ b/tests/test-verify-repo-operations.py Wed Feb 24 13:06:43 2016 +0000 @@ -123,6 +123,7 @@ # be provided as arguments to future operations. paths = Bundle('paths') contents = Bundle('contents') + branches = Bundle('branches') committimes = Bundle('committimes') def __init__(self): @@ -240,6 +241,13 @@ def gencontent(self, content): return content + @rule( + target=branches, + name=safetext, + ) + def genbranch(self, name): + return name + @rule(target=paths, source=paths) def lowerpath(self, source): return source.lower() @@ -359,6 +367,32 @@ def export(self): self.hg("export") + # Section: Branch management + @rule() + def checkbranch(self): + self.hg("branch") + + @rule(branch=branches) + def switchbranch(self, branch): + with acceptableerrors( + 'cannot use an integer as a name', + 'cannot be used in a name', + 'a branch of the same name already exists', + 'is reserved', + ): + self.hg("branch", "--", branch) + + @rule(branch=branches, clean=st.booleans()) + def update(self, branch, clean): + with acceptableerrors( + 'unknown revision', + 'parse error', + ): + if clean: + self.hg("update", "-C", "--", branch) + else: + self.hg("update", "--", branch) + settings.register_profile( 'default', settings( timeout=300,