Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from dart-lang/devoncarew_coverage
Browse files Browse the repository at this point in the history
add more tests
  • Loading branch information
devoncarew committed Mar 20, 2015
2 parents 0c69792 + 0c0675e commit 8eb40f8
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
77 changes: 77 additions & 0 deletions test/pub_cache_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,82 @@ void defineTests() {
PubCache cache = new PubCache();
expect(cache.getBinaries(), isNotNull);
});

test('getGlobalApplications', () {
PubCache cache = new PubCache();
expect(cache.getGlobalApplications(), isNotEmpty);
});

test('getPackageRefs', () {
PubCache cache = new PubCache();
expect(cache.getPackageRefs(), isNotEmpty);
});
});

group('Application', () {
PubCache cache;
Application app;

setUp(() {
cache = new PubCache();
app = cache.getGlobalApplications().first;
});

test('name', () {
expect(app.name, isNotEmpty);
});

test('version', () {
expect(app.version, isNotNull);
});

test('getPackageRefs', () {
expect(app.getPackageRefs(), isNotEmpty);
});

test('toString', () {
expect(app.toString(), isNotEmpty);
});
});

group('PackageRef', () {
PubCache cache;
Application app;
PackageRef ref;

setUp(() {
cache = new PubCache();
app = cache.getGlobalApplications().first;
ref = app.getPackageRefs().first;
});

test('name', () {
expect(ref.name, isNotEmpty);
});

test('==', () {
PackageRef ref0 = app.getPackageRefs()[0];
PackageRef ref1 = app.getPackageRefs()[1];

expect(ref0, equals(ref0));
expect(ref0, isNot(equals(ref1)));
});

test('resolve', () {
expect(ref.resolve(), isNotNull);
});

test('toString', () {
expect(ref.toString(), isNotEmpty);
});
});

group('Package', () {
test('toString', () {
PubCache cache = new PubCache();
Package p = cache.getPackageRefs().first.resolve();
expect(p, isNotNull);
expect(p.toString(), isNotEmpty);
});
});
}
3 changes: 2 additions & 1 deletion tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Fast fail the script on failures.
set -e

pub global activate dart_coveralls

# Verify that the libraries are error free.
dartanalyzer --fatal-warnings \
example/list.dart \
Expand All @@ -18,7 +20,6 @@ dart test/all.dart

# Install dart_coveralls; gather and send coverage data.
if [ "$COVERALLS_TOKEN" ]; then
pub global activate dart_coveralls
pub global run dart_coveralls report \
--token $COVERALLS_TOKEN \
--retry 2 \
Expand Down

0 comments on commit 8eb40f8

Please sign in to comment.