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>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
</component>
</module>

View file

@ -2,7 +2,12 @@
<project version="4">
<component name="ProjectModuleManager">
<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>
</component>
</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:
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>
homepage: https://github.com/thosakwe/graphql_parser
environment:
sdk: ">=1.19.0"
sdk: ">=1.8.0 <3.0.0"
dependencies:
source_span: ^1.0.0
string_scanner: ^1.0.0

View file

@ -37,7 +37,7 @@ class _IsArgument extends Matcher {
@override
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;
print(arg.toSource());
return equals(name).matches(arg.name, matchState) &&
@ -61,7 +61,7 @@ class _IsArgumentList extends Matcher {
@override
bool matches(item, Map matchState) {
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;

View file

@ -58,7 +58,7 @@ class _IsDirective extends Matcher {
@override
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 (valueOrVariable != null) {
if (directive.valueOrVariable == null)
@ -91,7 +91,7 @@ class _IsDirectiveList extends Matcher {
@override
bool matches(item, Map matchState) {
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;

View file

@ -98,7 +98,7 @@ class _IsField extends Matcher {
@override
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 (fieldName != null && !fieldName.matches(field.fieldName, matchState))
return false;
@ -122,7 +122,7 @@ class _IsFieldName extends Matcher {
@override
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)
return fieldName.alias?.alias == name && fieldName.alias?.name == realName;
else

View file

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

View file

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

View file

@ -66,7 +66,7 @@ class _IsSelectionSet extends Matcher {
@override
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.selections.length != selections.length) return false;

View file

@ -64,7 +64,7 @@ class _IsListType extends Matcher {
@override
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.isNullable != (isNullable != false)) return false;
return innerType.matches(type.listType.type, matchState);
@ -87,7 +87,7 @@ class _IsType extends Matcher {
@override
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;
var result = type.typeName.name == name;
return result && type.isNullable == !(nonNull == true);

View file

@ -59,7 +59,7 @@ class _IsValue extends Matcher {
@override
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);
}
}

View file

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

View file

@ -29,8 +29,8 @@ class _IsVariable extends Matcher {
}
@override
bool matches(String item, Map matchState) {
var p = parse(item);
bool matches(item, Map matchState) {
var p = parse(item.toString());
var v = p.parseVariable();
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>