mirror of
https://github.com/kataras/iris.git
synced 2025-12-27 14:57:05 +00:00
release v12.2.5
This commit is contained in:
@@ -403,33 +403,15 @@ func TestBindingsForStruct(t *testing.T) {
|
||||
},
|
||||
// 1. test controller with pre-defined variables.
|
||||
{
|
||||
Value: &controller{Name: "name_struct", Service: new(serviceImpl)},
|
||||
Expected: []*binding{
|
||||
{
|
||||
Dependency: NewDependency("name_struct"),
|
||||
Input: &Input{Index: 0, StructFieldIndex: []int{0}, Type: reflect.TypeOf("")},
|
||||
},
|
||||
{
|
||||
Dependency: NewDependency(new(serviceImpl)),
|
||||
Input: &Input{Index: 1, StructFieldIndex: []int{1}, Type: serviceTyp},
|
||||
},
|
||||
},
|
||||
Value: &controller{Name: "name_struct", Service: new(serviceImpl)},
|
||||
Expected: nil,
|
||||
},
|
||||
// 2. test controller with pre-defined variables and other deps with the exact order and value
|
||||
// (deps from non zero values should be registerded only, if not the Dependency:name_struct will fail for sure).
|
||||
// (deps from non zero values should be not registerded, if not the Dependency:name_struct will fail for sure).
|
||||
{
|
||||
Value: &controller{Name: "name_struct", Service: new(serviceImpl)},
|
||||
Registered: deps,
|
||||
Expected: []*binding{
|
||||
{
|
||||
Dependency: NewDependency("name_struct"),
|
||||
Input: &Input{Index: 0, StructFieldIndex: []int{0}, Type: reflect.TypeOf("")},
|
||||
},
|
||||
{
|
||||
Dependency: NewDependency(new(serviceImpl)),
|
||||
Input: &Input{Index: 1, StructFieldIndex: []int{1}, Type: serviceTyp},
|
||||
},
|
||||
},
|
||||
Expected: nil,
|
||||
},
|
||||
// 3. test embedded structs with anonymous and exported.
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user