From f652c40a8d81bae77ffdf7875753ef7b601075ad Mon Sep 17 00:00:00 2001 From: Francis Bourre Date: Fri, 30 Jun 2017 10:05:11 +0200 Subject: [PATCH] Tests added for Fix: ReflectionBuilder doesn't reflect module which belongs types. --- test/context/flow/mapTypeAttribute.flow | 6 +++++- test/context/xml/mapTypeAttribute.xml | 1 + .../compiletime/flow/BasicFlowCompilerTest.hx | 5 +++++ .../flow/BasicStaticFlowCompilerTest.hx | 4 ++++ .../xml/BasicStaticXmlCompilerTest.hx | 4 ++++ .../compiletime/xml/BasicXmlCompilerTest.hx | 6 ++++++ test/hex/mock/MockClass.hx | 5 +++++ test/hex/mock/MockModuleWithInternalType.hx | 20 +++++++++++++++++++ 8 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 test/hex/mock/MockModuleWithInternalType.hx diff --git a/test/context/flow/mapTypeAttribute.flow b/test/context/flow/mapTypeAttribute.flow index b2dd6b6..4e75aee 100644 --- a/test/context/flow/mapTypeAttribute.flow +++ b/test/context/flow/mapTypeAttribute.flow @@ -1,4 +1,8 @@ @context( name = 'applicationContext' ) { - @map_type( 'hex.mock.IMockInterface' ) instance = new hex.mock.MockClass(); + @map_type( 'hex.mock.IMockInterface' ) + instance = new hex.mock.MockClass(); + + @map_type( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef' ) + instance2 = new hex.mock.MockClass(); } \ No newline at end of file diff --git a/test/context/xml/mapTypeAttribute.xml b/test/context/xml/mapTypeAttribute.xml index 1af70d8..aa79899 100644 --- a/test/context/xml/mapTypeAttribute.xml +++ b/test/context/xml/mapTypeAttribute.xml @@ -1,5 +1,6 @@ + \ No newline at end of file diff --git a/test/hex/compiletime/flow/BasicFlowCompilerTest.hx b/test/hex/compiletime/flow/BasicFlowCompilerTest.hx index 8b36346..23c9fb0 100644 --- a/test/hex/compiletime/flow/BasicFlowCompilerTest.hx +++ b/test/hex/compiletime/flow/BasicFlowCompilerTest.hx @@ -627,6 +627,11 @@ class BasicFlowCompilerTest Assert.isInstanceOf( instance, MockClass ); Assert.isInstanceOf( instance, IMockInterface ); Assert.equals( instance, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstance( IMockInterface, "instance" ) ); + + var instance2 : MockClass = this._getCoreFactory().locate( "instance2" ); + Assert.isNotNull( instance2 ); + Assert.isInstanceOf( instance2, MockClass ); + Assert.equals( instance2, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstanceWithClassName( "hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef", "instance2" ) ); } @Test( "test multi map-type attributes" ) diff --git a/test/hex/compiletime/flow/BasicStaticFlowCompilerTest.hx b/test/hex/compiletime/flow/BasicStaticFlowCompilerTest.hx index d854e64..e0aa85b 100644 --- a/test/hex/compiletime/flow/BasicStaticFlowCompilerTest.hx +++ b/test/hex/compiletime/flow/BasicStaticFlowCompilerTest.hx @@ -664,6 +664,10 @@ class BasicStaticFlowCompilerTest Assert.isInstanceOf( code.locator.instance, MockClass ); Assert.isInstanceOf( code.locator.instance, IMockInterface ); Assert.equals( code.locator.instance, code.applicationContext.getInjector().getInstance( IMockInterface, "instance" ) ); + + Assert.isNotNull( code.locator.instance2 ); + Assert.isInstanceOf( code.locator.instance2, MockClass ); + Assert.equals( code.locator.instance2, code.applicationContext.getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) ); } @Test( "test multi map-type attributes" ) diff --git a/test/hex/compiletime/xml/BasicStaticXmlCompilerTest.hx b/test/hex/compiletime/xml/BasicStaticXmlCompilerTest.hx index de23785..dc05625 100644 --- a/test/hex/compiletime/xml/BasicStaticXmlCompilerTest.hx +++ b/test/hex/compiletime/xml/BasicStaticXmlCompilerTest.hx @@ -661,6 +661,10 @@ class BasicStaticXmlCompilerTest Assert.isInstanceOf( code.locator.instance, MockClass ); Assert.isInstanceOf( code.locator.instance, IMockInterface ); Assert.equals( code.locator.instance, code.applicationContext.getInjector().getInstance( IMockInterface, "instance" ) ); + + Assert.isNotNull( code.locator.instance2 ); + Assert.isInstanceOf( code.locator.instance2, MockClass ); + Assert.equals( code.locator.instance2, code.applicationContext.getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) ); } @Test( "test multi map-type attributes" ) diff --git a/test/hex/compiletime/xml/BasicXmlCompilerTest.hx b/test/hex/compiletime/xml/BasicXmlCompilerTest.hx index c0e5017..86e1ea4 100644 --- a/test/hex/compiletime/xml/BasicXmlCompilerTest.hx +++ b/test/hex/compiletime/xml/BasicXmlCompilerTest.hx @@ -25,6 +25,7 @@ import hex.mock.MockContextHolder; import hex.mock.MockFruitVO; import hex.mock.MockInjectee; import hex.mock.MockMethodCaller; +import hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef; import hex.mock.MockObjectWithRegtangleProperty; import hex.mock.MockProxy; import hex.mock.MockReceiver; @@ -634,6 +635,11 @@ class BasicXmlCompilerTest Assert.isInstanceOf( instance, MockClass ); Assert.isInstanceOf( instance, IMockInterface ); Assert.equals( instance, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstance( IMockInterface, "instance" ) ); + + var instance2 : MockClass = this._getCoreFactory().locate( "instance2" ); + Assert.isNotNull( instance2 ); + Assert.isInstanceOf( instance2, MockClass ); + Assert.equals( instance2, this._applicationAssembler.getApplicationContext( "applicationContext", ApplicationContext ).getInjector().getInstanceWithClassName( 'hex.mock.MockModuleWithInternalType.GetInfosInternalTypedef', "instance2" ) ); } @Test( "test multi map-type attributes" ) diff --git a/test/hex/mock/MockClass.hx b/test/hex/mock/MockClass.hx index 561998d..c78131d 100644 --- a/test/hex/mock/MockClass.hx +++ b/test/hex/mock/MockClass.hx @@ -14,4 +14,9 @@ class MockClass implements IMockInterface implements IAnotherMockInterface { } + + public function getInfos() : String + { + return 'infos'; + } } \ No newline at end of file diff --git a/test/hex/mock/MockModuleWithInternalType.hx b/test/hex/mock/MockModuleWithInternalType.hx new file mode 100644 index 0000000..1aea063 --- /dev/null +++ b/test/hex/mock/MockModuleWithInternalType.hx @@ -0,0 +1,20 @@ +package hex.mock; + +/** + * ... + * @author Francis Bourre + */ +class MockModuleWithInternalType +{ + + public function new() + { + + } + +} + +typedef GetInfosInternalTypedef = +{ + function getInfos() : String; +} \ No newline at end of file