-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add coverage options file locator tests
- Loading branch information
1 parent
8d3ca0c
commit c6452f7
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'dart:io'; | ||
import 'package:coverage/src/coverage_options.dart'; | ||
import 'package:path/path.dart' as path; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
final baseTestPath = 'test/test_file_locator'; | ||
late Directory testDirectory; | ||
|
||
test('options file exists', () { | ||
testDirectory = Directory('$baseTestPath/pkg1/lib/src'); | ||
var filePath = | ||
CoverageOptionsProvider.findOptionsFilePath(directory: testDirectory); | ||
expect(path.normalize('$baseTestPath/pkg1/coverage_options.yaml'), | ||
path.normalize(filePath!)); | ||
|
||
testDirectory = Directory('$baseTestPath/pkg1/lib'); | ||
filePath = | ||
CoverageOptionsProvider.findOptionsFilePath(directory: testDirectory); | ||
expect(path.normalize('$baseTestPath/pkg1/coverage_options.yaml'), | ||
path.normalize(filePath!)); | ||
}); | ||
|
||
test('options file missing', () { | ||
testDirectory = Directory('$baseTestPath/pkg2/lib/src'); | ||
var filePath = | ||
CoverageOptionsProvider.findOptionsFilePath(directory: testDirectory); | ||
expect(filePath, isNull); | ||
|
||
testDirectory = Directory('$baseTestPath/pkg2/lib'); | ||
filePath = | ||
CoverageOptionsProvider.findOptionsFilePath(directory: testDirectory); | ||
expect(filePath, isNull); | ||
}); | ||
|
||
test('no pubspec found', () { | ||
var filePath = CoverageOptionsProvider.findOptionsFilePath( | ||
directory: Directory.systemTemp); | ||
expect(filePath, isNull); | ||
|
||
filePath = CoverageOptionsProvider.findOptionsFilePath( | ||
directory: Directory.systemTemp); | ||
expect(filePath, isNull); | ||
}); | ||
} |
Empty file.
Empty file.
Empty file.