@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 89 lines 3.0 kB view raw
1<?php 2 3final class DiffusionMercurialCommandEngineTests extends PhabricatorTestCase { 4 5 public function testFilteringDebugOutput() { 6 $map = array( 7 '' => '', 8 9 "quack\n" => "quack\n", 10 11 "ignoring untrusted configuration option x.y = z\nquack\n" => 12 "quack\n", 13 14 "ignoring untrusted configuration option x.y = z\n". 15 "ignoring untrusted configuration option x.y = z\n". 16 "quack\n" => 17 "quack\n", 18 19 "ignoring untrusted configuration option x.y = z\n". 20 "ignoring untrusted configuration option x.y = z\n". 21 "ignoring untrusted configuration option x.y = z\n". 22 "quack\n" => 23 "quack\n", 24 25 "quack\n". 26 "ignoring untrusted configuration option x.y = z\n". 27 "ignoring untrusted configuration option x.y = z\n". 28 "ignoring untrusted configuration option x.y = z\n" => 29 "quack\n", 30 31 "ignoring untrusted configuration option x.y = z\n". 32 "ignoring untrusted configuration option x.y = z\n". 33 "duck\n". 34 "ignoring untrusted configuration option x.y = z\n". 35 "ignoring untrusted configuration option x.y = z\n". 36 "bread\n". 37 "ignoring untrusted configuration option x.y = z\n". 38 "quack\n" => 39 "duck\nbread\nquack\n", 40 41 "ignoring untrusted configuration option x.y = z\n". 42 "duckignoring untrusted configuration option x.y = z\n". 43 "quack" => 44 'duckquack', 45 ); 46 47 foreach ($map as $input => $expect) { 48 $actual = DiffusionMercurialCommandEngine::filterMercurialDebugOutput( 49 $input); 50 $this->assertEqual($expect, $actual, $input); 51 } 52 53 // Output that should be filtered out from the results 54 $output = 55 "ignoring untrusted configuration option\n". 56 "couldn't write revision branch cache:\n". 57 "couldn't write branch cache: blah blah blah\n". 58 "invalid branchheads cache\n". 59 "invalid branch cache (served): tip differs\n". 60 "starting pager for command 'log'\n". 61 "updated patterns: ". 62 ".hglf/project/src/a/b/c/SomeClass.java, ". 63 "project/src/a/b/c/SomeClass.java\n". 64 "no terminfo entry for sitm\n"; 65 66 $filtered_output = 67 DiffusionMercurialCommandEngine::filterMercurialDebugOutput($output); 68 69 $this->assertEqual('', $filtered_output); 70 71 // The output that should make it through the filtering 72 $output = 73 "0b33a9e5ceedba14b03214f743957357d7bb46a9;694". 74 ":8b39f63eb209dd2bdfd4bd3d0721a9e38d75a6d3". 75 "-1:0000000000000000000000000000000000000000\n". 76 "8b39f63eb209dd2bdfd4bd3d0721a9e38d75a6d3;693". 77 ":165bce9ce4ccc97024ba19ed5a22f6a066fa6844". 78 "-1:0000000000000000000000000000000000000000\n". 79 "165bce9ce4ccc97024ba19ed5a22f6a066fa6844;692:". 80 "2337bc9e3cf212b3b386b5197801b1c81db64920". 81 "-1:0000000000000000000000000000000000000000\n"; 82 83 $filtered_output = 84 DiffusionMercurialCommandEngine::filterMercurialDebugOutput($output); 85 86 $this->assertEqual($output, $filtered_output); 87 } 88 89}