Fix type errors in tests

This commit is contained in:
Tobe O 2018-08-02 09:05:52 -04:00
parent 47a561bb65
commit 659a124478
22 changed files with 84 additions and 19 deletions

View file

@ -10,6 +10,5 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
</component> </component>
</module> </module>

View file

@ -2,7 +2,12 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/graphql_parser.iml" filepath="$PROJECT_DIR$/.idea/graphql_parser.iml" /> <module fileurl="file://$PROJECT_DIR$/angel_graphql/angel_graphql.iml" filepath="$PROJECT_DIR$/angel_graphql/angel_graphql.iml" />
<module fileurl="file://$PROJECT_DIR$/graphql.iml" filepath="$PROJECT_DIR$/graphql.iml" />
<module fileurl="file://$PROJECT_DIR$/graphql_generator/graphql_generator.iml" filepath="$PROJECT_DIR$/graphql_generator/graphql_generator.iml" />
<module fileurl="file://$PROJECT_DIR$/graphql_parser/graphql_parser.iml" filepath="$PROJECT_DIR$/graphql_parser/graphql_parser.iml" />
<module fileurl="file://$PROJECT_DIR$/graphql_schema/graphql_schema.iml" filepath="$PROJECT_DIR$/graphql_schema/graphql_schema.iml" />
<module fileurl="file://$PROJECT_DIR$/graphql_server/graphql_server.iml" filepath="$PROJECT_DIR$/graphql_server/graphql_server.iml" />
</modules> </modules>
</component> </component>
</project> </project>

View file

@ -0,0 +1,3 @@
analyzer:
strong-mode:
implicit-casts: false

View file

@ -0,0 +1,3 @@
analyzer:
strong-mode:
implicit-casts: false

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View file

@ -1,2 +1,3 @@
analyzer: analyzer:
strong-mode: true strong-mode:
implicit-casts: false

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View file

@ -4,7 +4,7 @@ description: Parses GraphQL queries and schemas.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/thosakwe/graphql_parser homepage: https://github.com/thosakwe/graphql_parser
environment: environment:
sdk: ">=1.19.0" sdk: ">=1.8.0 <3.0.0"
dependencies: dependencies:
source_span: ^1.0.0 source_span: ^1.0.0
string_scanner: ^1.0.0 string_scanner: ^1.0.0

View file

@ -37,7 +37,7 @@ class _IsArgument extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var arg = item is ArgumentContext ? item : parseArgument(item); var arg = item is ArgumentContext ? item : parseArgument(item.toString());
if (arg == null) return false; if (arg == null) return false;
print(arg.toSource()); print(arg.toSource());
return equals(name).matches(arg.name, matchState) && return equals(name).matches(arg.name, matchState) &&
@ -61,7 +61,7 @@ class _IsArgumentList extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var args = var args =
item is List<ArgumentContext> ? item : parse(item).parseArguments(); item is List<ArgumentContext> ? item : parse(item.toString()).parseArguments();
if (args.length != arguments.length) return false; if (args.length != arguments.length) return false;

View file

@ -58,7 +58,7 @@ class _IsDirective extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var directive = item is DirectiveContext ? item : parseDirective(item); var directive = item is DirectiveContext ? item : parseDirective(item.toString());
if (directive == null) return false; if (directive == null) return false;
if (valueOrVariable != null) { if (valueOrVariable != null) {
if (directive.valueOrVariable == null) if (directive.valueOrVariable == null)
@ -91,7 +91,7 @@ class _IsDirectiveList extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var args = var args =
item is List<DirectiveContext> ? item : parse(item).parseDirectives(); item is List<DirectiveContext> ? item : parse(item.toString()).parseDirectives();
if (args.length != directives.length) return false; if (args.length != directives.length) return false;

View file

@ -98,7 +98,7 @@ class _IsField extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var field = item is FieldContext ? item : parseField(item); var field = item is FieldContext ? item : parseField(item.toString());
if (field == null) return false; if (field == null) return false;
if (fieldName != null && !fieldName.matches(field.fieldName, matchState)) if (fieldName != null && !fieldName.matches(field.fieldName, matchState))
return false; return false;
@ -122,7 +122,7 @@ class _IsFieldName extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var fieldName = item is FieldNameContext ? item : parseFieldName(item); var fieldName = item is FieldNameContext ? item : parseFieldName(item.toString());
if (realName != null) if (realName != null)
return fieldName.alias?.alias == name && fieldName.alias?.name == realName; return fieldName.alias?.alias == name && fieldName.alias?.name == realName;
else else

View file

@ -44,7 +44,7 @@ class _IsFragmentSpread extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var spread = var spread =
item is FragmentSpreadContext ? item : parseFragmentSpread(item); item is FragmentSpreadContext ? item : parseFragmentSpread(item.toString());
if (spread == null) return false; if (spread == null) return false;
if (spread.name != name) return false; if (spread.name != name) return false;
if (directives != null) if (directives != null)

View file

@ -59,7 +59,7 @@ class _IsInlineFragment extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var fragment = var fragment =
item is InlineFragmentContext ? item : parseInlineFragment(item); item is InlineFragmentContext ? item : parseInlineFragment(item.toString());
if (fragment == null) return false; if (fragment == null) return false;
if (fragment.typeCondition.typeName.name != name) return false; if (fragment.typeCondition.typeName.name != name) return false;
if (directives != null && if (directives != null &&

View file

@ -66,7 +66,7 @@ class _IsSelectionSet extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var set = item is SelectionSetContext ? item : parseSelectionSet(item); var set = item is SelectionSetContext ? item : parseSelectionSet(item.toString());
if (set == null) return false; if (set == null) return false;
if (set.selections.length != selections.length) return false; if (set.selections.length != selections.length) return false;

View file

@ -64,7 +64,7 @@ class _IsListType extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var type = item is TypeContext ? item : parseType(item); var type = item is TypeContext ? item : parseType(item.toString());
if (type.listType == null) return false; if (type.listType == null) return false;
if (type.isNullable != (isNullable != false)) return false; if (type.isNullable != (isNullable != false)) return false;
return innerType.matches(type.listType.type, matchState); return innerType.matches(type.listType.type, matchState);
@ -87,7 +87,7 @@ class _IsType extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var type = item is TypeContext ? item : parseType(item); var type = item is TypeContext ? item : parseType(item.toString());
if (type.typeName == null) return false; if (type.typeName == null) return false;
var result = type.typeName.name == name; var result = type.typeName.name == name;
return result && type.isNullable == !(nonNull == true); return result && type.isNullable == !(nonNull == true);

View file

@ -59,7 +59,7 @@ class _IsValue extends Matcher {
@override @override
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var v = item is ValueContext ? item : parseValue(item); var v = item is ValueContext ? item : parseValue(item.toString());
return equals(value).matches(v.value, matchState); return equals(value).matches(v.value, matchState);
} }
} }

View file

@ -58,7 +58,7 @@ class _IsVariableDefinition extends Matcher {
bool matches(item, Map matchState) { bool matches(item, Map matchState) {
var def = item is VariableDefinitionContext var def = item is VariableDefinitionContext
? item ? item
: parseVariableDefinition(item); : parseVariableDefinition(item.toString());
if (def == null) return false; if (def == null) return false;
if (def.variable.name != name) return false; if (def.variable.name != name) return false;
bool result = true; bool result = true;

View file

@ -29,8 +29,8 @@ class _IsVariable extends Matcher {
} }
@override @override
bool matches(String item, Map matchState) { bool matches(item, Map matchState) {
var p = parse(item); var p = parse(item.toString());
var v = p.parseVariable(); var v = p.parseVariable();
return equals(name).matches(v?.name, matchState); return equals(name).matches(v?.name, matchState);
} }

View file

@ -0,0 +1,3 @@
analyzer:
strong-mode:
implicit-casts: false

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View file

@ -0,0 +1,3 @@
analyzer:
strong-mode:
implicit-casts: false

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>