forked from hhvm/hhast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinterCLITestTrait.hack
More file actions
33 lines (29 loc) · 822 Bytes
/
LinterCLITestTrait.hack
File metadata and controls
33 lines (29 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
namespace Facebook\HHAST;
use type Facebook\CLILib\Terminal;
use namespace HH\Lib\{IO, Vec};
trait LinterCLITestTrait {
require extends TestCase;
protected function getCLI(
string ...$argv
): (__Private\LinterCLI, IO\MemoryHandle, IO\MemoryHandle, IO\MemoryHandle) {
$argv = Vec\concat(vec[__FILE__], $argv);
$stdin = new IO\MemoryHandle();
$stdout = new IO\MemoryHandle();
$stderr = new IO\MemoryHandle();
$term = new Terminal($stdin, $stdout, $stderr);
return tuple(
new __Private\LinterCLI($argv, $term),
$stdin,
$stdout,
$stderr,
);
}
}