diff options
Diffstat (limited to 'testing/03-treedelta-rules.yarn')
-rw-r--r-- | testing/03-treedelta-rules.yarn | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/testing/03-treedelta-rules.yarn b/testing/03-treedelta-rules.yarn index 699327d..f96524e 100644 --- a/testing/03-treedelta-rules.yarn +++ b/testing/03-treedelta-rules.yarn @@ -91,3 +91,81 @@ we do to `target_tree` we can't push... THEN stderr contains Needs a FOO FINALLY the instance is torn down + +Tree deltas +----------- + +When there are trees in play, the `treediff/targets`, `treediff/added`, +`treediff/deleted`, `treediff/modified`, `treediff/renamed`, and +`treediff/renamedto` values end up set. + +The _targets_ are any name which shows up in any of _added_, _deleted_, +_modified_, _renamed_, or _renamedto_. The others are, respectively, the +names of new tree entries, removed tree entries, entries whose content has +changed, and then rename detection logic. + +> Sadly currently Gitano can't tell which rename from/to is matched with which. + +First up, let's ensure that `treediff/targets` works for the various kinds +of adding, modifying, removing, and renaming operations... + + SCENARIO any change must affect FOO + GIVEN a standard instance + AND a unix user called alice + AND alice has keys called main + + WHEN testinstance, using adminkey, adds user alice, using alice main + AND testinstance adminkey runs create testrepo alice + AND alice, using main, clones testrepo as testrepo + THEN alice testrepo has no file called FOO + + GIVEN testinstance using adminkey has patched gitano-admin with must-affect-FOO.patch + +First up, when we try an empty commit we can't push it... + + WHEN alice, using main, expecting failure, pushes an empty commit in testrepo + THEN stderr contains Needs a FOO + +Next, when a FOO is added, it should turn up in `treediff/targets` + + WHEN alice applies add-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains new branch + +But its mere presence in `start_tree` shouldn't allow empty commits... + + WHEN alice, using main, expecting failure, pushes an empty commit in testrepo + THEN stderr contains Needs a FOO + +Now we verify that altering the content turns up in `treediff/targets` + + WHEN alice applies change-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains master -> master + +Next, when the FOO gets removed, it should show in `treediff/targets` + + WHEN alice reverts change-a-FOO.patch in testrepo + AND alice reverts add-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains master -> master + +Next we need to rename a FOO, to do that, first add it back... + + WHEN alice applies add-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains master -> master + +and then check that renaming the FOO causes it to turn up in `treediff/targets` + + WHEN alice applies rename-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains master -> master + +and finally we ensure that renaming it *back* works too... + + WHEN alice reverts rename-a-FOO.patch in testrepo + AND alice, using main, pushes testrepo to testrepo.git + THEN the output contains master -> master + + FINALLY the instance is torn down |