Changeset View
Changeset View
Standalone View
Standalone View
src/parser/__tests__/ArcanistBundleTestCase.php
| Show First 20 Lines • Show All 636 Lines • ▼ Show 20 Lines | public function testDisjointHunks() { | ||||
| // Diffs need to generate without overlapping hunks. | // Diffs need to generate without overlapping hunks. | ||||
| $this->assertEqual( | $this->assertEqual( | ||||
| $this->loadResource('disjoint-hunks.diff'), | $this->loadResource('disjoint-hunks.diff'), | ||||
| $this->loadOneChangeBundle( | $this->loadOneChangeBundle( | ||||
| 'disjoint-hunks.old', | 'disjoint-hunks.old', | ||||
| 'disjoint-hunks.new')->toUnifiedDiff()); | 'disjoint-hunks.new')->toUnifiedDiff()); | ||||
| } | } | ||||
| public function testMergeHunks() { | |||||
| // Hunks should merge if represented by sufficiently few unchanged | |||||
| // lines. | |||||
| $this->assertEqual( | |||||
| $this->loadResource('merge-hunks.diff'), | |||||
| $this->loadOneChangeBundle( | |||||
| 'merge-hunks.old', | |||||
| 'merge-hunks.new')->toUnifiedDiff()); | |||||
| // Hunks should not merge if they are separated by too many unchanged | |||||
| // lines. | |||||
| $this->assertEqual( | |||||
| $this->loadResource('no-merge-hunks.diff'), | |||||
| $this->loadOneChangeBundle( | |||||
| 'no-merge-hunks.old', | |||||
| 'no-merge-hunks.new')->toUnifiedDiff()); | |||||
| } | |||||
| public function testNonlocalTrailingNewline() { | public function testNonlocalTrailingNewline() { | ||||
| // Diffs without changes near the end of the file should not generate a | // Diffs without changes near the end of the file should not generate a | ||||
| // bogus, change-free hunk if the file has no trailing newline. | // bogus, change-free hunk if the file has no trailing newline. | ||||
| $this->assertEqual( | $this->assertEqual( | ||||
| $this->loadResource('trailing-newline.diff'), | $this->loadResource('trailing-newline.diff'), | ||||
| $this->loadOneChangeBundle( | $this->loadOneChangeBundle( | ||||
| 'trailing-newline.old', | 'trailing-newline.old', | ||||
| 'trailing-newline.new')->toUnifiedDiff()); | 'trailing-newline.new')->toUnifiedDiff()); | ||||
| ▲ Show 20 Lines • Show All 318 Lines • Show Last 20 Lines | |||||