Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
500d7c50
Unverified
Commit
500d7c50
authored
Aug 05, 2019
by
Zachary Anderson
Committed by
GitHub
Aug 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Additional flutter manifest yaml validation (#37422)
parent
4ccd8119
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
flutter_manifest.dart
packages/flutter_tools/lib/src/flutter_manifest.dart
+6
-1
flutter_manifest_test.dart
...utter_tools/test/general.shard/flutter_manifest_test.dart
+20
-0
No files found.
packages/flutter_tools/lib/src/flutter_manifest.dart
View file @
500d7c50
...
...
@@ -404,7 +404,12 @@ void _validateFonts(YamlList fonts, List<String> errors) {
const
Set
<
int
>
fontWeights
=
<
int
>{
100
,
200
,
300
,
400
,
500
,
600
,
700
,
800
,
900
,
};
for
(
final
YamlMap
fontMap
in
fonts
)
{
for
(
final
dynamic
fontListEntry
in
fonts
)
{
if
(
fontListEntry
is
!
YamlMap
)
{
errors
.
add
(
'Unexpected child "
$fontListEntry
" found under "fonts". Expected a map.'
);
continue
;
}
final
YamlMap
fontMap
=
fontListEntry
;
for
(
dynamic
key
in
fontMap
.
keys
.
where
((
dynamic
key
)
=>
key
!=
'family'
&&
key
!=
'fonts'
))
{
errors
.
add
(
'Unexpected child "
$key
" found under "fonts".'
);
}
...
...
packages/flutter_tools/test/general.shard/flutter_manifest_test.dart
View file @
500d7c50
...
...
@@ -518,6 +518,26 @@ flutter:
expect
(
flutterManifest
,
null
);
expect
(
logger
.
errorText
,
contains
(
'Expected "fonts" to either be null or a list.'
));
});
testUsingContext
(
'Returns proper error when second font family is invalid'
,
()
async
{
final
BufferLogger
logger
=
context
.
get
<
Logger
>();
const
String
manifest
=
'''
name: test
dependencies:
flutter:
sdk: flutter
flutter:
uses-material-design: true
fonts:
- family: foo
fonts:
- asset: a/bar
- string
'''
;
final
FlutterManifest
flutterManifest
=
FlutterManifest
.
createFromString
(
manifest
);
expect
(
flutterManifest
,
null
);
expect
(
logger
.
errorText
,
contains
(
'Expected a map.'
));
});
});
group
(
'FlutterManifest with MemoryFileSystem'
,
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment