Skip to content
This repository has been archived by the owner on Dec 6, 2017. It is now read-only.

Parameterized Test Failure #170 #172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ class InjectableTest {
const InjectableTest();
}

@InjectableTest()
class ParameterizedClass<T>{
T t;
}

class GenericArgument{

}

@InjectableTest()
class ClassWithParameterizedDependency{
ParameterizedClass<GenericArgument> _parameterizedClass;

ClassWithParameterizedDependency(this._parameterizedClass);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the style:

  • space before "{"
  • indentation is 2 white spaces


// just some classes for testing
@InjectableTest()
class Engine {
Expand Down Expand Up @@ -389,6 +405,16 @@ createInjectorSpec(String injectorName, ModuleFactory moduleFactory) {
expect(instance.strs).toEqual(['1', '2']);
});

it('should resolve dependencies with parameterized types using non primitive', () {
var module = moduleFactory()
..bind(new TypeLiteral<ParameterizedClass<GenericArgument>>().type, inject: [], toFactory: () => new ParameterizedClass<GenericArgument>())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var module sould be indented with 2ws, continuation line with 4 and pls max sure you don't cross the 100 chars limit

..bind(ClassWithParameterizedDependency);
var injector = new ModuleInjector([module]);
var instance = injector.get(ClassWithParameterizedDependency);

expect(instance).toBeAnInstanceOf(ClassWithParameterizedDependency);
});

it('should resolve dependencies with parameterized types (TypeLiteral)', () {
var injector = new ModuleInjector([moduleFactory()
..bind(new TypeLiteral<Map<num, String>>().type, toValue: {1 : 'first', 2: 'second'})
Expand Down