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
aa96eb29
Unverified
Commit
aa96eb29
authored
Apr 08, 2021
by
Jenn Magder
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate intellij tests and context_test to null safety (#80008)
parent
fdb16cd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
35 deletions
+29
-35
context_test.dart
...s/flutter_tools/test/general.shard/base/context_test.dart
+18
-20
intellij_test.dart
...tter_tools/test/general.shard/intellij/intellij_test.dart
+8
-10
intellij_validator_test.dart
.../test/general.shard/intellij/intellij_validator_test.dart
+3
-5
No files found.
packages/flutter_tools/test/general.shard/base/context_test.dart
View file @
aa96eb29
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:flutter_tools/src/base/context.dart'
;
...
...
@@ -13,7 +11,7 @@ import '../../src/common.dart';
void
main
(
)
{
group
(
'AppContext'
,
()
{
group
(
'global getter'
,
()
{
bool
called
;
late
bool
called
;
setUp
(()
{
called
=
false
;
...
...
@@ -78,7 +76,7 @@ void main() {
test
(
'still finds values if async code runs after body has finished'
,
()
async
{
final
Completer
<
void
>
outer
=
Completer
<
void
>();
final
Completer
<
void
>
inner
=
Completer
<
void
>();
String
value
;
String
?
value
;
await
context
.
run
<
void
>(
body:
()
{
outer
.
future
.
then
<
void
>((
_
)
{
...
...
@@ -98,10 +96,10 @@ void main() {
test
(
'caches generated override values'
,
()
async
{
int
consultationCount
=
0
;
String
value
;
String
?
value
;
await
context
.
run
<
void
>(
body:
()
async
{
final
StringBuffer
buf
=
StringBuffer
(
context
.
get
<
String
>());
final
StringBuffer
buf
=
StringBuffer
(
context
.
get
<
String
>()
!
);
buf
.
write
(
context
.
get
<
String
>());
await
context
.
run
<
void
>(
body:
()
{
buf
.
write
(
context
.
get
<
String
>());
...
...
@@ -121,10 +119,10 @@ void main() {
test
(
'caches generated fallback values'
,
()
async
{
int
consultationCount
=
0
;
String
value
;
String
?
value
;
await
context
.
run
(
body:
()
async
{
final
StringBuffer
buf
=
StringBuffer
(
context
.
get
<
String
>());
final
StringBuffer
buf
=
StringBuffer
(
context
.
get
<
String
>()
!
);
buf
.
write
(
context
.
get
<
String
>());
await
context
.
run
<
void
>(
body:
()
{
buf
.
write
(
context
.
get
<
String
>());
...
...
@@ -143,7 +141,7 @@ void main() {
});
test
(
'returns null if generated value is null'
,
()
async
{
final
String
value
=
await
context
.
run
<
String
>(
final
String
?
value
=
await
context
.
run
<
String
?
>(
body:
()
=>
context
.
get
<
String
>(),
overrides:
<
Type
,
Generator
>{
String
:
()
=>
null
,
...
...
@@ -153,14 +151,14 @@ void main() {
});
test
(
'throws if generator has dependency cycle'
,
()
async
{
final
Future
<
String
>
value
=
context
.
run
<
String
>(
final
Future
<
String
?>
value
=
context
.
run
<
String
?
>(
body:
()
async
{
return
context
.
get
<
String
>();
},
fallbacks:
<
Type
,
Generator
>{
int
:
()
=>
int
.
parse
(
context
.
get
<
String
>()),
int
:
()
=>
int
.
parse
(
context
.
get
<
String
>()
??
''
),
String
:
()
=>
'
${context.get<double>()}
'
,
double
:
()
=>
context
.
get
<
int
>()
*
1.0
,
double
:
()
=>
context
.
get
<
int
>()
!
*
1.0
,
},
);
try
{
...
...
@@ -187,16 +185,16 @@ void main() {
});
group
(
'fallbacks'
,
()
{
bool
called
;
late
bool
called
;
setUp
(()
{
called
=
false
;
});
test
(
'are applied after parent context is consulted'
,
()
async
{
final
String
value
=
await
context
.
run
<
String
>(
final
String
?
value
=
await
context
.
run
<
String
?
>(
body:
()
{
return
context
.
run
<
String
>(
return
context
.
run
<
String
?
>(
body:
()
{
called
=
true
;
return
context
.
get
<
String
>();
...
...
@@ -213,9 +211,9 @@ void main() {
test
(
'are not applied if parent context supplies value'
,
()
async
{
bool
childConsulted
=
false
;
final
String
value
=
await
context
.
run
<
String
>(
final
String
?
value
=
await
context
.
run
<
String
?
>(
body:
()
{
return
context
.
run
<
String
>(
return
context
.
run
<
String
?
>(
body:
()
{
called
=
true
;
return
context
.
get
<
String
>();
...
...
@@ -238,7 +236,7 @@ void main() {
});
test
(
'may depend on one another'
,
()
async
{
final
String
value
=
await
context
.
run
<
String
>(
final
String
?
value
=
await
context
.
run
<
String
?
>(
body:
()
{
return
context
.
get
<
String
>();
},
...
...
@@ -254,9 +252,9 @@ void main() {
group
(
'overrides'
,
()
{
test
(
'intercept consultation of parent context'
,
()
async
{
bool
parentConsulted
=
false
;
final
String
value
=
await
context
.
run
<
String
>(
final
String
?
value
=
await
context
.
run
<
String
?
>(
body:
()
{
return
context
.
run
<
String
>(
return
context
.
run
<
String
?
>(
body:
()
=>
context
.
get
<
String
>(),
overrides:
<
Type
,
Generator
>{
String
:
()
=>
'child'
,
...
...
packages/flutter_tools/test/general.shard/intellij/intellij_test.dart
View file @
aa96eb29
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:convert'
;
import
'package:archive/archive.dart'
;
...
...
@@ -16,7 +14,7 @@ import 'package:flutter_tools/src/intellij/intellij.dart';
import
'../../src/common.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
late
FileSystem
fileSystem
;
void
writeFileCreatingDirectories
(
String
path
,
List
<
int
>
bytes
)
{
final
File
file
=
fileSystem
.
file
(
path
);
...
...
@@ -40,7 +38,7 @@ void main() {
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'Dart'
,
'lib'
,
'Dart.jar'
),
ZipEncoder
().
encode
(
dartJarArchive
),
ZipEncoder
().
encode
(
dartJarArchive
)
!
,
);
final
Archive
flutterJarArchive
=
buildSingleFileArchive
(
'META-INF/plugin.xml'
,
r''
'
...
...
@@ -51,7 +49,7 @@ void main() {
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'flutter-intellij.jar'
),
ZipEncoder
().
encode
(
flutterJarArchive
),
ZipEncoder
().
encode
(
flutterJarArchive
)
!
,
);
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
...
...
@@ -82,14 +80,14 @@ void main() {
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'flutter-intellij'
,
'lib'
,
'flutter-idea-50.0.jar'
),
ZipEncoder
().
encode
(
flutterIdeaJarArchive
),
ZipEncoder
().
encode
(
flutterIdeaJarArchive
)
!
,
);
final
Archive
flutterIntellijJarArchive
=
buildSingleFileArchive
(
'META-INF/MANIFEST.MF'
,
r''
'
Manifest-Version: 1.0
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'flutter-intellij'
,
'lib'
,
'flutter-intellij-50.0.jar'
),
ZipEncoder
().
encode
(
flutterIntellijJarArchive
),
ZipEncoder
().
encode
(
flutterIntellijJarArchive
)
!
,
);
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
...
...
@@ -118,7 +116,7 @@ Manifest-Version: 1.0
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'flutter-intellij'
,
'lib'
,
'flutter-idea-50.0.jar'
),
ZipEncoder
().
encode
(
flutterIdeaJarArchive
),
ZipEncoder
().
encode
(
flutterIdeaJarArchive
)
!
,
);
final
Archive
flutterIntellijJarArchive
=
buildSingleFileArchive
(
'META-INF/plugin.xml'
,
r''
'
<idea-plugin version="2">
...
...
@@ -128,7 +126,7 @@ Manifest-Version: 1.0
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'flutter-intellij'
,
'lib'
,
'flutter-intellij-50.0.jar'
),
ZipEncoder
().
encode
(
flutterIntellijJarArchive
),
ZipEncoder
().
encode
(
flutterIntellijJarArchive
)
!
,
);
final
List
<
ValidationMessage
>
messages
=
<
ValidationMessage
>[];
...
...
@@ -176,7 +174,7 @@ Manifest-Version: 1.0
'''
);
writeFileCreatingDirectories
(
fileSystem
.
path
.
join
(
_kPluginsPath
,
'Dart'
,
'lib'
,
'Other.jar'
),
ZipEncoder
().
encode
(
dartJarArchive
),
ZipEncoder
().
encode
(
dartJarArchive
)
!
,
);
expect
(
...
...
packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart
View file @
aa96eb29
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:archive/archive.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
...
@@ -332,7 +330,7 @@ class FakePlistParser extends Fake implements PlistParser {
final
Map
<
String
,
String
>
values
;
@override
String
getValueFromFile
(
String
plistFilePath
,
String
key
)
{
String
?
getValueFromFile
(
String
plistFilePath
,
String
key
)
{
return
values
[
key
];
}
}
...
...
@@ -379,7 +377,7 @@ void createIntellijFlutterPluginJar(String pluginJarPath, FileSystem fileSystem,
flutterPlugins
.
addFile
(
ArchiveFile
(
'META-INF/plugin.xml'
,
flutterPluginBytes
.
length
,
flutterPluginBytes
));
fileSystem
.
file
(
pluginJarPath
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
ZipEncoder
().
encode
(
flutterPlugins
));
..
writeAsBytesSync
(
ZipEncoder
().
encode
(
flutterPlugins
)
!
);
}
...
...
@@ -416,5 +414,5 @@ void createIntellijDartPluginJar(String pluginJarPath, FileSystem fileSystem) {
dartPlugins
.
addFile
(
ArchiveFile
(
'META-INF/plugin.xml'
,
dartPluginBytes
.
length
,
dartPluginBytes
));
fileSystem
.
file
(
pluginJarPath
)
..
createSync
(
recursive:
true
)
..
writeAsBytesSync
(
ZipEncoder
().
encode
(
dartPlugins
));
..
writeAsBytesSync
(
ZipEncoder
().
encode
(
dartPlugins
)
!
);
}
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