forked from hhvm/hhast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDontDiscardNewExpressionsLinterTest.hack
More file actions
33 lines (29 loc) · 1.01 KB
/
DontDiscardNewExpressionsLinterTest.hack
File metadata and controls
33 lines (29 loc) · 1.01 KB
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;
final class DontDiscardNewExpressionsLinterTest extends TestCase {
use LinterTestTrait;
<<__Override>>
protected function getLinter(string $file): DontDiscardNewExpressionsLinter {
return DontDiscardNewExpressionsLinter::fromPathWithConfig(
$file,
shape('exceptionSuffixes' => vec['Exception', 'MyCustomSuffix']),
);
}
<<__Override>>
public function getCleanExamples(): vec<(string)> {
return vec[
tuple('<?hh function _(): void { $_ = new DateTime(); }'),
tuple('<?hh function _(): void { $x = new DateTime(); }'),
tuple('<?hh function _(): DateTime { return new DateTime(); }'),
tuple('<?hh function _(): nothing { throw new Exception(); }'),
tuple('<?hh function _(): void { (new MyClass())->drop(); }'),
];
}
}