Updated test cases
This commit is contained in:
parent
959078fa95
commit
14a7b82616
9 changed files with 829 additions and 4711 deletions
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 7.1.0
|
||||
|
||||
* Require Dart >= 2.18
|
||||
|
||||
## 7.0.0
|
||||
|
||||
* Require Dart >= 2.17
|
||||
|
|
|
@ -97,7 +97,7 @@ class Container {
|
|||
/// In contexts where a static generic type cannot be used, use
|
||||
/// the [type] argument, instead of [T].
|
||||
T make<T>([Type? type]) {
|
||||
var t2 = T;
|
||||
Type t2 = T;
|
||||
if (type != null) {
|
||||
t2 = type;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class Container {
|
|||
|
||||
var reflectedType = reflector.reflectType(t2);
|
||||
var positional = [];
|
||||
var named = <String, dynamic>{};
|
||||
var named = <String, Object>{};
|
||||
|
||||
if (reflectedType is ReflectedClass) {
|
||||
bool isDefault(String name) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: angel3_container
|
||||
version: 7.0.0
|
||||
version: 7.1.0
|
||||
description: Angel3 hierarchical DI container, and pluggable backends for reflection.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container
|
||||
environment:
|
||||
sdk: '>=2.17.0 <3.0.0'
|
||||
sdk: '>=2.18.0 <3.0.0'
|
||||
dependencies:
|
||||
collection: ^1.15.0
|
||||
quiver: ^3.0.1
|
||||
|
|
|
@ -0,0 +1,299 @@
|
|||
// This file has been generated by the reflectable package.
|
||||
// https://github.com/dart-lang/reflectable.
|
||||
|
||||
import 'dart:core';
|
||||
import 'package:angel3_container_generator/angel3_container_generator.dart'
|
||||
as prefix0;
|
||||
import 'package:reflectable/capability.dart' as prefix1;
|
||||
import 'package:reflectable/mirrors.dart' as prefix2;
|
||||
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: prefer_adjacent_string_concatenation
|
||||
// ignore_for_file: prefer_collection_literals
|
||||
// ignore_for_file: unnecessary_const
|
||||
|
||||
// ignore:unused_import
|
||||
import 'package:reflectable/mirrors.dart' as m;
|
||||
// ignore:unused_import
|
||||
import 'package:reflectable/src/reflectable_builder_based.dart' as r;
|
||||
// ignore:unused_import
|
||||
import 'package:reflectable/reflectable.dart' as r show Reflectable;
|
||||
|
||||
final _data = <r.Reflectable, r.ReflectorData>{
|
||||
const prefix0.ContainedReflectable(): r.ReflectorData(
|
||||
<m.TypeMirror>[
|
||||
r.NonGenericClassMirrorImpl(
|
||||
r'ContainedReflectable',
|
||||
r'.ContainedReflectable',
|
||||
134217735,
|
||||
0,
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <int>[0],
|
||||
const <int>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
const <int>[],
|
||||
-1,
|
||||
{},
|
||||
{},
|
||||
{r'': (bool b) => () => b ? prefix0.ContainedReflectable() : null},
|
||||
0,
|
||||
0,
|
||||
const <int>[],
|
||||
const <Object>[prefix0.contained],
|
||||
null)
|
||||
],
|
||||
<m.DeclarationMirror>[
|
||||
r.MethodMirrorImpl(r'', 128, 0, -1, 0, 0, const <int>[], const <int>[],
|
||||
const prefix0.ContainedReflectable(), const []),
|
||||
r.MethodMirrorImpl(r'==', 2097154, -1, -1, 1, 1, const <int>[],
|
||||
const <int>[0], const prefix0.ContainedReflectable(), const []),
|
||||
r.MethodMirrorImpl(r'toString', 2097154, -1, -1, 2, 2, const <int>[],
|
||||
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||
r.MethodMirrorImpl(
|
||||
r'noSuchMethod',
|
||||
524290,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
const <int>[],
|
||||
const <int>[1],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const []),
|
||||
r.MethodMirrorImpl(r'hashCode', 2097155, -1, -1, 3, 3, const <int>[],
|
||||
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||
r.MethodMirrorImpl(r'runtimeType', 2097155, -1, -1, 4, 4, const <int>[],
|
||||
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||
r.MethodMirrorImpl(
|
||||
r'capabilities',
|
||||
35651587,
|
||||
-1,
|
||||
-1,
|
||||
6,
|
||||
7,
|
||||
const <int>[5],
|
||||
const <int>[],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const []),
|
||||
r.MethodMirrorImpl(
|
||||
r'canReflect',
|
||||
2097154,
|
||||
-1,
|
||||
-1,
|
||||
1,
|
||||
1,
|
||||
const <int>[],
|
||||
const <int>[2],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'reflect',
|
||||
2097154,
|
||||
-1,
|
||||
-1,
|
||||
8,
|
||||
8,
|
||||
const <int>[],
|
||||
const <int>[3],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'canReflectType',
|
||||
2097154,
|
||||
-1,
|
||||
-1,
|
||||
1,
|
||||
1,
|
||||
const <int>[],
|
||||
const <int>[4],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'reflectType',
|
||||
2097154,
|
||||
-1,
|
||||
-1,
|
||||
9,
|
||||
9,
|
||||
const <int>[],
|
||||
const <int>[5],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'findLibrary',
|
||||
2097154,
|
||||
-1,
|
||||
-1,
|
||||
10,
|
||||
10,
|
||||
const <int>[],
|
||||
const <int>[6],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'libraries',
|
||||
35651587,
|
||||
-1,
|
||||
-1,
|
||||
12,
|
||||
13,
|
||||
const <int>[11, 10],
|
||||
const <int>[],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override]),
|
||||
r.MethodMirrorImpl(
|
||||
r'annotatedClasses',
|
||||
35651587,
|
||||
-1,
|
||||
-1,
|
||||
15,
|
||||
16,
|
||||
const <int>[14],
|
||||
const <int>[],
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <Object>[override])
|
||||
],
|
||||
<m.ParameterMirror>[
|
||||
r.ParameterMirrorImpl(
|
||||
r'other',
|
||||
134348806,
|
||||
1,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
17,
|
||||
17,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'invocation',
|
||||
134348806,
|
||||
3,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
18,
|
||||
18,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'reflectee',
|
||||
134348806,
|
||||
7,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
17,
|
||||
17,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'reflectee',
|
||||
134348806,
|
||||
8,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
17,
|
||||
17,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'type',
|
||||
134348806,
|
||||
9,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
4,
|
||||
4,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'type',
|
||||
134348806,
|
||||
10,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
4,
|
||||
4,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null),
|
||||
r.ParameterMirrorImpl(
|
||||
r'libraryName',
|
||||
134348806,
|
||||
11,
|
||||
const prefix0.ContainedReflectable(),
|
||||
-1,
|
||||
2,
|
||||
2,
|
||||
const <int>[],
|
||||
const [],
|
||||
null,
|
||||
null)
|
||||
],
|
||||
<Type>[
|
||||
prefix0.ContainedReflectable,
|
||||
bool,
|
||||
String,
|
||||
int,
|
||||
Type,
|
||||
prefix1.ReflectCapability,
|
||||
const m.TypeValue<List<prefix1.ReflectCapability>>().type,
|
||||
List,
|
||||
prefix2.InstanceMirror,
|
||||
prefix2.TypeMirror,
|
||||
prefix2.LibraryMirror,
|
||||
Uri,
|
||||
const m.TypeValue<Map<Uri, prefix2.LibraryMirror>>().type,
|
||||
Map,
|
||||
prefix2.ClassMirror,
|
||||
const m.TypeValue<Iterable<prefix2.ClassMirror>>().type,
|
||||
Iterable,
|
||||
Object,
|
||||
Invocation
|
||||
],
|
||||
1,
|
||||
{
|
||||
r'==': (dynamic instance) => (x) => instance == x,
|
||||
r'toString': (dynamic instance) => instance.toString,
|
||||
r'noSuchMethod': (dynamic instance) => instance.noSuchMethod,
|
||||
r'hashCode': (dynamic instance) => instance.hashCode,
|
||||
r'runtimeType': (dynamic instance) => instance.runtimeType,
|
||||
r'capabilities': (dynamic instance) => instance.capabilities,
|
||||
r'canReflect': (dynamic instance) => instance.canReflect,
|
||||
r'reflect': (dynamic instance) => instance.reflect,
|
||||
r'canReflectType': (dynamic instance) => instance.canReflectType,
|
||||
r'reflectType': (dynamic instance) => instance.reflectType,
|
||||
r'findLibrary': (dynamic instance) => instance.findLibrary,
|
||||
r'libraries': (dynamic instance) => instance.libraries,
|
||||
r'annotatedClasses': (dynamic instance) => instance.annotatedClasses
|
||||
},
|
||||
{},
|
||||
<m.LibraryMirror>[
|
||||
r.LibraryMirrorImpl(
|
||||
r'',
|
||||
Uri.parse(r'reflectable://0/'),
|
||||
const prefix0.ContainedReflectable(),
|
||||
const <int>[],
|
||||
{},
|
||||
{},
|
||||
const [],
|
||||
null)
|
||||
],
|
||||
[])
|
||||
};
|
||||
|
||||
final _memberSymbolMap = null;
|
||||
|
||||
void initializeReflectable() {
|
||||
r.data = _data;
|
||||
r.memberSymbolMap = _memberSymbolMap;
|
||||
}
|
|
@ -8,15 +8,13 @@ const Reflectable contained = ContainedReflectable();
|
|||
class ContainedReflectable extends Reflectable {
|
||||
const ContainedReflectable()
|
||||
: super(
|
||||
declarationsCapability,
|
||||
instanceInvokeCapability,
|
||||
invokingCapability,
|
||||
metadataCapability,
|
||||
newInstanceCapability,
|
||||
reflectedTypeCapability,
|
||||
typeRelationsCapability,
|
||||
typingCapability,
|
||||
);
|
||||
typeAnnotationQuantifyCapability,
|
||||
superclassQuantifyCapability,
|
||||
instanceInvokeCapability,
|
||||
invokingCapability,
|
||||
newInstanceCapability,
|
||||
reflectedTypeCapability,
|
||||
typingCapability);
|
||||
}
|
||||
|
||||
/// A [Reflector] instance that uses a [Reflectable] to reflect upon data.
|
||||
|
|
|
@ -13,6 +13,6 @@ dev_dependencies:
|
|||
build_test: ^2.1.3
|
||||
test: ^1.21.0
|
||||
lints: ^2.0.0
|
||||
# dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../angel_container
|
||||
dependency_overrides:
|
||||
angel3_container:
|
||||
path: ../angel_container
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
import 'package:angel3_container/angel3_container.dart';
|
||||
import 'package:angel3_container_generator/angel3_container_generator.dart';
|
||||
|
||||
@GlobalQuantifyCapability(
|
||||
r'^dart\.core\.(Iterable|List|String|int|Object)', contained)
|
||||
import 'package:reflectable/reflectable.dart';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'reflector_test.reflectable.dart';
|
||||
|
||||
void main() {
|
||||
initializeReflectable();
|
||||
|
||||
var reflector = const GeneratedReflector();
|
||||
late Container container;
|
||||
|
||||
|
@ -112,6 +109,9 @@ void testReflector(Reflector reflector) {
|
|||
var kantoPokemonType = container.reflector.reflectType(KantoPokemon)!;
|
||||
|
||||
expect(kantoPokemonType.isAssignableTo(pokemonType), true);
|
||||
|
||||
var a = container.reflector.reflectType(String);
|
||||
|
||||
expect(
|
||||
kantoPokemonType
|
||||
.isAssignableTo(container.reflector.reflectType(String)),
|
||||
|
@ -153,12 +153,12 @@ enum PokemonType { water, fire, grass, ice, poison, flying }
|
|||
|
||||
@contained
|
||||
class Artist {
|
||||
final String? name;
|
||||
final String name;
|
||||
|
||||
Artist({this.name});
|
||||
Artist({required this.name});
|
||||
|
||||
String get lowerName {
|
||||
return name!.toLowerCase();
|
||||
return name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,5 +178,5 @@ class AlbumLength {
|
|||
|
||||
AlbumLength(this.artist, this.album);
|
||||
|
||||
int get totalLength => artist.name!.length + album.title.length;
|
||||
int get totalLength => artist.name.length + album.title.length;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,7 @@ dev_dependencies:
|
|||
angel3_framework: ^7.0.0
|
||||
build_runner: ^2.0.1
|
||||
lints: ^2.0.0
|
||||
dependency_overrides:
|
||||
# dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../../container/angel_container
|
||||
# angel3_framework:
|
||||
|
@ -40,5 +40,5 @@ dependency_overrides:
|
|||
# path: ../angel_orm
|
||||
# angel3_migration:
|
||||
# path: ../angel_migration
|
||||
angel3_orm_generator:
|
||||
path: ../angel_orm_generator
|
||||
# angel3_orm_generator:
|
||||
# path: ../angel_orm_generator
|
||||
|
|
Loading…
Reference in a new issue