1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-02-02 09:58:23 +01:00

Add a large number of move/copy diff/patch tests

Summary: The way we represent some move/copy stuff is a bit messed up, but it mostly works, so add coverage before I mess with it.

Test Plan: Ran unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T866

Differential Revision: https://secure.phabricator.com/D3752
This commit is contained in:
epriestley 2012-10-20 08:43:31 -07:00
parent 4b03a3fa0d
commit 6114d7cf9c
12 changed files with 336 additions and 0 deletions

View file

@ -146,6 +146,154 @@ final class ArcanistBundleTestCase extends ArcanistTestCase {
}
switch ($commit) {
case 'c573c25d1a767d270fed504cd993e78aba936338':
// "Copy a koan over text, editing the original koan."
// Git doesn't really do anything meaningful with this.
$this->assertEqual(2, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_CHANGE,
$c->getType());
$c = $changes['text'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_CHANGE,
$c->getType());
break;
case 'd26628e588cf7d16368845b121c6ac6c781e81d0':
// "Copy a koan, modifying both the source and destination."
$this->assertEqual(2, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_COPY_AWAY,
$c->getType());
$c = $changes['koan2'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_COPY_HERE,
$c->getType());
break;
case 'b0c9663ecda5f666f62dad245a3a7549aac5e636':
// "Remove a koan copy."
$this->assertEqual(1, count($changes));
$c = $changes['koan2'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_DELETE,
$c->getType());
break;
case 'b6ecdb3b4801f3028d88ba49940a558360847dbf':
// "Copy a koan and edit the destination."
// Git does not detect this as a copy without --find-copies-harder.
$this->assertEqual(1, count($changes));
$c = $changes['koan2'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_ADD,
$c->getType());
break;
case '30d23787e1ecd254c884afbe37afa612f61e3904':
// "Move and edit a koan."
$this->assertEqual(2, count($changes));
$c = $changes['koan2'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_AWAY,
$c->getType());
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_HERE,
$c->getType());
break;
case 'c0ba9bfe3695f95c3f558bc5797eeba421d32483':
// "Remove two koans."
$this->assertEqual(2, count($changes));
$c = $changes['koan3'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_DELETE,
$c->getType());
$c = $changes['koan4'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_DELETE,
$c->getType());
break;
case '2658fd01d5355abe5d4c7ead3a0e7b4b3449fe77':
// "Multicopy a koan."
$this->assertEqual(3, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MULTICOPY,
$c->getType());
$c = $changes['koan3'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_COPY_HERE,
$c->getType());
$c = $changes['koan4'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_HERE,
$c->getType());
break;
case '1c5fe4e2243bb19d6b3bf15896177b13768e6eb6':
// "Copy a koan."
// Git does not detect this as a copy without --find-copies-harder.
$this->assertEqual(1, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_ADD,
$c->getType());
break;
case '6d9eb65a2c2b56dee64d72f59554c1cca748dd34':
// "Move a koan."
$this->assertEqual(2, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_AWAY,
$c->getType());
$c = $changes['koan2'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_MOVE_HERE,
$c->getType());
break;
case '141452e2a775ee86409e8779dd2eda767b4fe8ab':
// "Add a koan."
$this->assertEqual(1, count($changes));
$c = $changes['koan'];
$this->assertEqual(
ArcanistDiffChangeType::TYPE_ADD,
$c->getType());
break;
case '5dec8bf28557f078d1987c4e8cfb53d08310f522':
// "Copy an image, and replace the original."
// `image_2.png` is copied to `image.png` and then replaced.

Binary file not shown.

View file

@ -0,0 +1,18 @@
diff --git a/koan b/koan
new file mode 100644
--- /dev/null
+++ b/koan
@@ -0,0 +1,12 @@
+A monk asked Joshu,
+"Has a dog Buddha nature?"
+Joshu replied, "Mu".
+
+The quick brown
+fox jumped over
+the lazy dog.
+
+Git only detects changes
+as moves if both files
+are mostly similar. So
+you need a lot of text.

View file

@ -0,0 +1,18 @@
diff --git a/koan b/koan
new file mode 100644
--- /dev/null
+++ b/koan
@@ -0,0 +1,12 @@
+A monk asked Joshu,
+"Has a dog Buddha nature?"
+Joshu replied, "Mu".
+
+The quick brown
+fox jumped over
+the lazy dog.
+
+Git only detects changes
+as moves if both files
+are mostly similar. So
+you need a lot of text.

View file

@ -0,0 +1,7 @@
diff --git a/koan b/koan3
rename from koan
rename to koan3
diff --git a/koan b/koan4
rename from koan
rename to koan4

View file

@ -0,0 +1,14 @@
diff --git a/koan2 b/koan
rename from koan2
rename to koan
--- a/koan2
+++ b/koan
@@ -1,6 +1,6 @@
A monk asked Joshu,
"Has a dog Buddha nature?"
-Joshu replied, "Mu".
+Joshu replied, "No".
The quick brown
fox jumped over

View file

@ -0,0 +1,4 @@
diff --git a/koan b/koan2
rename from koan
rename to koan2

View file

@ -0,0 +1,18 @@
diff --git a/koan2 b/koan2
deleted file mode 100644
--- a/koan2
+++ /dev/null
@@ -1,12 +0,0 @@
-A monk asked Joshu,
-"Has a dog Buddha nature?"
-Joshu replied, "Yes".
-
-The quick brown
-fox jumped over
-the lazy dog.
-
-Git only detects changes
-as moves if both files
-are mostly similar. So
-you need a lot of text.

View file

@ -0,0 +1,18 @@
diff --git a/koan2 b/koan2
new file mode 100644
--- /dev/null
+++ b/koan2
@@ -0,0 +1,12 @@
+A monk asked Joshu,
+"Has a dog Buddha nature?"
+Joshu replied, "Yes".
+
+The quick brown
+fox jumped over
+the lazy dog.
+
+Git only detects changes
+as moves if both files
+are mostly similar. So
+you need a lot of text.

View file

@ -0,0 +1,35 @@
diff --git a/koan3 b/koan3
deleted file mode 100644
--- a/koan3
+++ /dev/null
@@ -1,12 +0,0 @@
-A monk asked Joshu,
-"Has a dog Buddha nature?"
-Joshu replied, "Mu".
-
-The quick brown
-fox jumped over
-the lazy dog.
-
-Git only detects changes
-as moves if both files
-are mostly similar. So
-you need a lot of text.
diff --git a/koan4 b/koan4
deleted file mode 100644
--- a/koan4
+++ /dev/null
@@ -1,12 +0,0 @@
-A monk asked Joshu,
-"Has a dog Buddha nature?"
-Joshu replied, "Mu".
-
-The quick brown
-fox jumped over
-the lazy dog.
-
-Git only detects changes
-as moves if both files
-are mostly similar. So
-you need a lot of text.

View file

@ -0,0 +1,31 @@
diff --git a/koan b/koan
--- a/koan
+++ b/koan
@@ -1,6 +1,6 @@
A monk asked Joshu,
"Has a dog Buddha nature?"
-Joshu replied, "What?".
+Joshu replied, "Hmm?".
The quick brown
fox jumped over
diff --git a/text b/text
--- a/text
+++ b/text
@@ -1,3 +1,12 @@
-quack quack
-I am a duck
-quack quack
+A monk asked Joshu,
+"Has a dog Buddha nature?"
+Joshu replied, "What?".
+
+The quick brown
+fox jumped over
+the lazy dog.
+
+Git only detects changes
+as moves if both files
+are mostly similar. So
+you need a lot of text.

View file

@ -0,0 +1,25 @@
diff --git a/koan b/koan
--- a/koan
+++ b/koan
@@ -1,6 +1,6 @@
A monk asked Joshu,
"Has a dog Buddha nature?"
-Joshu replied, "No".
+Joshu replied, "What?".
The quick brown
fox jumped over
diff --git a/koan b/koan2
copy from koan
copy to koan2
--- a/koan
+++ b/koan2
@@ -1,6 +1,6 @@
A monk asked Joshu,
"Has a dog Buddha nature?"
-Joshu replied, "No".
+Joshu replied, "Unask the question!".
The quick brown
fox jumped over