Skip to content

Commit

Permalink
fix(tests): workaround matcher bug
Browse files Browse the repository at this point in the history
Expects in guinness are not working with matchers. Removes dependency on matcher to work around the issue.

Closes dart-archive#216, dart-archive#219
  • Loading branch information
twieck committed Aug 14, 2015
1 parent 34649af commit b23dbca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dart --checked test/transformer_test.dart
echo "Building example..."
rm -rf example/build/
cd example
pub_out=$(pub build | tee /dev/tty | grep -F "mirror" || : )
pub_out=$(pub build | tee /dev/tty | grep "mirror" | grep -v "mirrors_remover" || : )
cd ..
echo "--------"

Expand Down
12 changes: 9 additions & 3 deletions test/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
library di.tests;

import 'package:guinness/guinness.dart';
import 'package:matcher/matcher.dart' as matcher;
import 'package:di/di.dart';
import 'package:di/annotations.dart';
import 'package:di/type_literal.dart';
Expand Down Expand Up @@ -788,8 +787,15 @@ createInjectorSpec(String injectorName, ModuleFactory moduleFactory) {
var parent = new ModuleInjector([moduleFactory()..bind(Engine)]);
var child = new ModuleInjector([moduleFactory()..bind(MockEngine)], parent);

expect(parent.types).to(matcher.unorderedEquals([Engine, Injector]));
expect(child.types).to(matcher.unorderedEquals([Engine, MockEngine, Injector]));
void expectUnorderedEquals(actual, expected) {
expect(actual.length).toEqual(expected.length);
expected.forEach((item) {
expect(actual).toContain(item);
});
}

expectUnorderedEquals(parent.types, [Engine, Injector]);
expectUnorderedEquals(child.types, [Engine, MockEngine, Injector]);
});

it('should inject instance from parent if not provided in child', () {
Expand Down

0 comments on commit b23dbca

Please sign in to comment.