Skip to content

Commit 00f00e1

Browse files
committed
Test data discovery spelunking.
1 parent e47f72e commit 00f00e1

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/lint_test.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@ import 'package:dart_lint/src/rules.dart';
1616
import 'package:path/path.dart' as p;
1717
import 'package:unittest/unittest.dart';
1818

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+
}
2035

2136
/// Linter engine tests
2237
void defineLinterEngineTests() {
@@ -117,7 +132,7 @@ void defineRuleTests() {
117132

118133
//TODO: if ruleDir cannot be found print message to set CWD to project root
119134
group('rule', () {
120-
for (var entry in new Directory(ruleDir).listSync()) {
135+
for (var entry in ruleDir.listSync()) {
121136
if (entry is! File || !entry.path.endsWith('.dart')) continue;
122137
var ruleName = p.basenameWithoutExtension(entry.path);
123138
testRule(ruleName, entry);

0 commit comments

Comments
 (0)