Skip to content

Commit

Permalink
Add lcov parsing test
Browse files Browse the repository at this point in the history
  • Loading branch information
adracus committed May 20, 2015
1 parent 098b24f commit 9ef0775
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/coveralls_collect_lcov_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
library dart_coveralls.test.collect_lcov;

import 'dart:io' show File, Platform;

import 'package:path/path.dart' show dirname;
import 'package:test/test.dart';
import 'package:dart_coveralls/dart_coveralls.dart';

main() => defineTests();

final directory = dirname(Platform.script.path);

defineTests() {
var lcovTest = new File("$directory/lcov_test.txt").readAsStringSync();

group("LcovPart", () {
test("parse", () {
var document = LcovDocument.parse(lcovTest);
expect(document.parts.length, equals(2));
expect(document.parts.first.heading,
equals("SF:collection/src/utils.dart"));
expect(document.parts.first.fileName, equals("collection/src/utils.dart"));
expect(document.parts.first.content,
equals("DA:12,0\n"));
expect(document.parts.last.heading,
equals("SF:string_scanner/src/utils.dart"));
expect(document.parts.last.fileName, equals("string_scanner/src/utils.dart"));
expect(document.parts.last.content,
equals("DA:10,0\nDA:14,0\nDA:15,0\nDA:16,0" +
"\nDA:17,0\nDA:22,0\nDA:23,0\nDA:26,0\nDA:27,0"));
});
});
}
14 changes: 14 additions & 0 deletions test/lcov_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SF:collection/src/utils.dart
DA:12,0
end_of_record
SF:string_scanner/src/utils.dart
DA:10,0
DA:14,0
DA:15,0
DA:16,0
DA:17,0
DA:22,0
DA:23,0
DA:26,0
DA:27,0
end_of_record
2 changes: 2 additions & 0 deletions test/test_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ library dart_coveralls.test;

import 'coveralls_entities_test.dart' as coveralls_entities;
import 'coveralls_test.dart' as coveralls;
import 'coveralls_collect_lcov_test.dart' as coveralls_lcov;

void main() {
coveralls_entities.main();
coveralls.main();
coveralls_lcov.main();
}

0 comments on commit 9ef0775

Please sign in to comment.