File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,22 @@ import 'package:dart_lint/src/rules.dart';
16
16
import 'package:path/path.dart' as p;
17
17
import 'package:unittest/unittest.dart' ;
18
18
19
- const ruleDir = 'test/rules' ;
19
+ Directory get ruleDir {
20
+
21
+ print ('CWD: ${Directory .current .path }' );
22
+ print ('CWD: ${Directory .current .absolute .path }' );
23
+
24
+ Directory dir = new Directory ('test/rules' );
25
+ if (dir.existsSync ()) {
26
+ return dir;
27
+ }
28
+
29
+ Directory testDir = new File (Platform .script.path).parent;
30
+ Directory rulesDir = new Directory (testDir.path + '/rules' );
31
+
32
+ print ('trying... ${rulesDir .absolute .path }' );
33
+ return rulesDir;
34
+ }
20
35
21
36
/// Linter engine tests
22
37
void defineLinterEngineTests () {
@@ -117,7 +132,7 @@ void defineRuleTests() {
117
132
118
133
//TODO: if ruleDir cannot be found print message to set CWD to project root
119
134
group ('rule' , () {
120
- for (var entry in new Directory ( ruleDir) .listSync ()) {
135
+ for (var entry in ruleDir.listSync ()) {
121
136
if (entry is ! File || ! entry.path.endsWith ('.dart' )) continue ;
122
137
var ruleName = p.basenameWithoutExtension (entry.path);
123
138
testRule (ruleName, entry);
You can’t perform that action at this time.
0 commit comments