forked from hhvm/hhast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnreachableCodeLinterTest.hack
More file actions
34 lines (30 loc) · 955 Bytes
/
UnreachableCodeLinterTest.hack
File metadata and controls
34 lines (30 loc) · 955 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
34
/*
* 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;
final class UnreachableCodeLinterTest extends TestCase {
use LinterTestTrait;
<<__Override>>
protected function getLinter(string $file): UnreachableCodeLinter {
return UnreachableCodeLinter::fromPath($file);
}
<<__Override>>
public function getCleanExamples(): vec<(string)> {
return vec[
tuple('<?hh function foo(): int { return 5; }'),
tuple('<?hh function foo(): void { return; }'),
tuple('<?hh function foo(): void { if (true) return; }'),
tuple(
'<?hh function foo(int $i): int { if ($i == 1) { return 5; } else { return 6; } }',
),
tuple(
'<?hh function foo(): void { return; /* comment node after return */ }',
),
];
}
}