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
4bcf8fb4
Unverified
Commit
4bcf8fb4
authored
May 24, 2021
by
Jenn Magder
Committed by
GitHub
May 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate compile to null safety (#83153)
parent
ade6e1f9
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
263 additions
and
266 deletions
+263
-266
compile.dart
packages/flutter_tools/lib/src/compile.dart
+185
-180
compile_batch_test.dart
.../flutter_tools/test/general.shard/compile_batch_test.dart
+24
-26
compile_expression_test.dart
...ter_tools/test/general.shard/compile_expression_test.dart
+22
-24
compile_incremental_test.dart
...er_tools/test/general.shard/compile_incremental_test.dart
+19
-21
compile_test.dart
packages/flutter_tools/test/general.shard/compile_test.dart
+13
-15
No files found.
packages/flutter_tools/lib/src/compile.dart
View file @
4bcf8fb4
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/compile_batch_test.dart
View file @
4bcf8fb4
...
...
@@ -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:file/memory.dart'
;
...
...
@@ -24,10 +22,10 @@ void main() {
stdoutHandler
.
reset
();
'result abc
\n
line1
\n
line2
\n
abc
\n
abc /path/to/main.dart.dill 0'
.
split
(
'
\n
'
).
forEach
(
stdoutHandler
.
handler
);
final
CompilerOutput
output
=
await
stdoutHandler
.
compilerOutput
.
future
;
final
CompilerOutput
?
output
=
await
stdoutHandler
.
compilerOutput
?
.
future
;
expect
(
logger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
output
?
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
});
testWithoutContext
(
'StdoutHandler can parse output for failed batch compilation'
,
()
async
{
...
...
@@ -36,7 +34,7 @@ void main() {
stdoutHandler
.
reset
();
'result abc
\n
line1
\n
line2
\n
abc
\n
abc'
.
split
(
'
\n
'
).
forEach
(
stdoutHandler
.
handler
);
final
CompilerOutput
output
=
await
stdoutHandler
.
compilerOutput
.
future
;
final
CompilerOutput
?
output
=
await
stdoutHandler
.
compilerOutput
?
.
future
;
expect
(
logger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
,
equals
(
null
));
...
...
@@ -73,7 +71,7 @@ void main() {
]),
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -81,10 +79,10 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
((
await
output
).
outputFilename
,
''
);
expect
((
await
output
)
?
.
outputFilename
,
''
);
});
testWithoutContext
(
'KernelCompiler returns null if StdoutHandler returns null'
,
()
async
{
...
...
@@ -118,7 +116,7 @@ void main() {
]),
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -126,7 +124,7 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
null
);
stdoutHandler
.
compilerOutput
?
.
complete
(
null
);
completer
.
complete
();
expect
(
await
output
,
null
);
...
...
@@ -163,7 +161,7 @@ void main() {
]),
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -171,7 +169,7 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
(
await
output
,
null
);
...
...
@@ -209,7 +207,7 @@ void main() {
]),
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
profile
,
trackWidgetCreation:
false
,
...
...
@@ -218,10 +216,10 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
((
await
output
).
outputFilename
,
''
);
expect
((
await
output
)
?
.
outputFilename
,
''
);
});
testWithoutContext
(
'passes correct AOT config to kernel compiler in aot/release mode'
,
()
async
{
...
...
@@ -256,7 +254,7 @@ void main() {
]),
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
release
,
trackWidgetCreation:
false
,
...
...
@@ -265,10 +263,10 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
((
await
output
).
outputFilename
,
''
);
expect
((
await
output
)
?
.
outputFilename
,
''
);
});
testWithoutContext
(
'KernelCompiler passes dartDefines to the frontend_server'
,
()
async
{
...
...
@@ -305,7 +303,7 @@ void main() {
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/path/to/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -314,10 +312,10 @@ void main() {
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
((
await
output
).
outputFilename
,
''
);
expect
((
await
output
)
?
.
outputFilename
,
''
);
});
testWithoutContext
(
'KernelCompiler maps a file to a multi-root scheme if provided'
,
()
async
{
...
...
@@ -354,7 +352,7 @@ void main() {
stdoutHandler:
stdoutHandler
,
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/foo/bar/fizz/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -363,10 +361,10 @@ void main() {
packagesPath:
'.packages'
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
expect
((
await
output
).
outputFilename
,
''
);
expect
((
await
output
)
?
.
outputFilename
,
''
);
});
testWithoutContext
(
'KernelCompiler uses generated entrypoint'
,
()
async
{
...
...
@@ -409,7 +407,7 @@ void main() {
buildDir
.
parent
.
childFile
(
'generated_main.dart'
).
createSync
(
recursive:
true
);
final
Future
<
CompilerOutput
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
final
Future
<
CompilerOutput
?
>
output
=
kernelCompiler
.
compile
(
sdkRoot:
'/path/to/sdkroot'
,
mainPath:
'/foo/bar/fizz/main.dart'
,
buildMode:
BuildMode
.
debug
,
trackWidgetCreation:
false
,
...
...
@@ -420,7 +418,7 @@ void main() {
checkDartPluginRegistry:
true
,
);
stdoutHandler
.
compilerOutput
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
stdoutHandler
.
compilerOutput
?
.
complete
(
const
CompilerOutput
(
''
,
0
,
<
Uri
>[]));
completer
.
complete
();
await
output
;
});
...
...
packages/flutter_tools/test/general.shard/compile_expression_test.dart
View file @
4bcf8fb4
...
...
@@ -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:file/memory.dart'
;
...
...
@@ -24,12 +22,12 @@ import '../src/fake_process_manager.dart';
import
'../src/fakes.dart'
;
void
main
(
)
{
FakeProcessManager
processManager
;
ResidentCompiler
generator
;
MemoryIOSink
frontendServerStdIn
;
StreamController
<
String
>
stdErrStreamController
;
BufferLogger
testLogger
;
MemoryFileSystem
fileSystem
;
late
FakeProcessManager
processManager
;
late
ResidentCompiler
generator
;
late
MemoryIOSink
frontendServerStdIn
;
late
StreamController
<
String
>
stdErrStreamController
;
late
BufferLogger
testLogger
;
late
MemoryFileSystem
fileSystem
;
setUp
(()
{
testLogger
=
BufferLogger
.
test
();
...
...
@@ -52,7 +50,7 @@ void main() {
});
testWithoutContext
(
'compile expression fails if not previously compiled'
,
()
async
{
final
CompilerOutput
result
=
await
generator
.
compileExpression
(
final
CompilerOutput
?
result
=
await
generator
.
compileExpression
(
'2+2'
,
null
,
null
,
null
,
null
,
false
);
expect
(
result
,
isNull
);
...
...
@@ -82,12 +80,12 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
projectRootPath:
''
,
fs:
fileSystem
,
).
then
((
CompilerOutput
output
)
{
).
then
((
CompilerOutput
?
output
)
{
expect
(
frontendServerStdIn
.
getAndClear
(),
'compile file:///path/to/main.dart
\n
'
);
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
output
!
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
compileExpressionResponseCompleter
.
complete
(
Future
<
List
<
int
>>.
value
(
utf8
.
encode
(
...
...
@@ -95,9 +93,9 @@ void main() {
)));
generator
.
compileExpression
(
'2+2'
,
null
,
null
,
null
,
null
,
false
).
then
(
(
CompilerOutput
outputExpression
)
{
(
CompilerOutput
?
outputExpression
)
{
expect
(
outputExpression
,
isNotNull
);
expect
(
outputExpression
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
expect
(
outputExpression
!
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
}
);
});
...
...
@@ -126,10 +124,10 @@ void main() {
packageConfig:
PackageConfig
.
empty
,
projectRootPath:
''
,
fs:
MemoryFileSystem
(),
).
then
((
CompilerOutput
outputCompile
)
{
).
then
((
CompilerOutput
?
outputCompile
)
{
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
outputCompile
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
outputCompile
!
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
fileSystem
.
file
(
'/path/to/main.dart.dill.incremental'
)
..
createSync
(
recursive:
true
)
...
...
@@ -144,9 +142,9 @@ void main() {
final
Completer
<
bool
>
lastExpressionCompleted
=
Completer
<
bool
>();
unawaited
(
generator
.
compileExpression
(
'0+1'
,
null
,
null
,
null
,
null
,
false
).
then
(
(
CompilerOutput
outputExpression
)
{
(
CompilerOutput
?
outputExpression
)
{
expect
(
outputExpression
,
isNotNull
);
expect
(
outputExpression
.
expressionData
,
<
int
>[
0
,
1
,
2
,
3
]);
expect
(
outputExpression
!
.
expressionData
,
<
int
>[
0
,
1
,
2
,
3
]);
fileSystem
.
file
(
'/path/to/main.dart.dill.incremental'
)
..
createSync
(
recursive:
true
)
...
...
@@ -161,9 +159,9 @@ void main() {
// The test manages timing via completers.
unawaited
(
generator
.
compileExpression
(
'1+1'
,
null
,
null
,
null
,
null
,
false
).
then
(
(
CompilerOutput
outputExpression
)
{
(
CompilerOutput
?
outputExpression
)
{
expect
(
outputExpression
,
isNotNull
);
expect
(
outputExpression
.
expressionData
,
<
int
>[
4
,
5
,
6
,
7
]);
expect
(
outputExpression
!
.
expressionData
,
<
int
>[
4
,
5
,
6
,
7
]);
lastExpressionCompleted
.
complete
(
true
);
},
),
...
...
@@ -179,13 +177,13 @@ void main() {
class
FakeProcess
extends
Fake
implements
Process
{
@override
Stream
<
List
<
int
>>
stdout
;
Stream
<
List
<
int
>>
stdout
=
const
Stream
<
List
<
int
>>.
empty
()
;
@override
Stream
<
List
<
int
>>
stderr
;
Stream
<
List
<
int
>>
stderr
=
const
Stream
<
List
<
int
>>.
empty
()
;
@override
IOSink
stdin
;
IOSink
stdin
=
IOSink
(
StreamController
<
List
<
int
>>().
sink
)
;
@override
Future
<
int
>
get
exitCode
=>
Completer
<
int
>().
future
;
...
...
@@ -195,12 +193,12 @@ class FakeProcessManager extends Fake implements ProcessManager {
final
FakeProcess
process
=
FakeProcess
();
@override
bool
canRun
(
dynamic
executable
,
{
String
workingDirectory
})
{
bool
canRun
(
dynamic
executable
,
{
String
?
workingDirectory
})
{
return
true
;
}
@override
Future
<
Process
>
start
(
List
<
Object
>
command
,
{
String
workingDirectory
,
Map
<
String
,
String
>
environment
,
bool
includeParentEnvironment
=
true
,
bool
runInShell
=
false
,
ProcessStartMode
mode
=
ProcessStartMode
.
normal
})
async
{
Future
<
Process
>
start
(
List
<
Object
>
command
,
{
String
?
workingDirectory
,
Map
<
String
,
String
>?
environment
,
bool
includeParentEnvironment
=
true
,
bool
runInShell
=
false
,
ProcessStartMode
mode
=
ProcessStartMode
.
normal
})
async
{
return
process
;
}
}
packages/flutter_tools/test/general.shard/compile_incremental_test.dart
View file @
4bcf8fb4
...
...
@@ -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:file/memory.dart'
;
...
...
@@ -21,13 +19,13 @@ import '../src/fake_process_manager.dart';
import
'../src/fakes.dart'
;
void
main
(
)
{
ResidentCompiler
generator
;
ResidentCompiler
generatorWithScheme
;
MemoryIOSink
frontendServerStdIn
;
BufferLogger
testLogger
;
StdoutHandler
generatorStdoutHandler
;
StdoutHandler
generatorWithSchemeStdoutHandler
;
FakeProcessManager
fakeProcessManager
;
late
ResidentCompiler
generator
;
late
ResidentCompiler
generatorWithScheme
;
late
MemoryIOSink
frontendServerStdIn
;
late
BufferLogger
testLogger
;
late
StdoutHandler
generatorStdoutHandler
;
late
StdoutHandler
generatorWithSchemeStdoutHandler
;
late
FakeProcessManager
fakeProcessManager
;
const
List
<
String
>
frontendServerCommand
=
<
String
>[
'HostArtifact.engineDartBinary'
,
...
...
@@ -87,7 +85,7 @@ void main() {
stdin:
frontendServerStdIn
,
));
final
CompilerOutput
output
=
await
generator
.
recompile
(
final
CompilerOutput
?
output
=
await
generator
.
recompile
(
Uri
.
parse
(
'/path/to/main.dart'
),
null
/* invalidatedFiles */
,
outputPath:
'/build/'
,
...
...
@@ -97,7 +95,7 @@ void main() {
);
expect
(
frontendServerStdIn
.
getAndClear
(),
'compile /path/to/main.dart
\n
'
);
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
output
?
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
...
...
@@ -114,7 +112,7 @@ void main() {
stdin:
frontendServerStdIn
,
));
final
CompilerOutput
output
=
await
generatorWithScheme
.
recompile
(
final
CompilerOutput
?
output
=
await
generatorWithScheme
.
recompile
(
Uri
.
parse
(
'file:///foo/bar/fizz/main.dart'
),
null
/* invalidatedFiles */
,
outputPath:
'/build/'
,
...
...
@@ -124,7 +122,7 @@ void main() {
);
expect
(
frontendServerStdIn
.
getAndClear
(),
'compile scheme:///main.dart
\n
'
);
expect
(
testLogger
.
errorText
,
equals
(
'line1
\n
line2
\n
'
));
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
output
?
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
expect
(
fakeProcessManager
,
hasNoRemainingExpectations
);
});
...
...
@@ -401,16 +399,16 @@ Future<void> _recompile(
MemoryIOSink
frontendServerStdIn
,
String
mockCompilerOutput
,
{
bool
suppressErrors
=
false
,
Uri
mainUri
,
Uri
?
mainUri
,
String
expectedMainUri
=
'/path/to/main.dart'
,
List
<
Uri
>
updatedUris
,
List
<
String
>
expectedUpdatedUris
,
List
<
Uri
>
?
updatedUris
,
List
<
String
>
?
expectedUpdatedUris
,
})
async
{
mainUri
??=
Uri
.
parse
(
'/path/to/main.dart'
);
updatedUris
??=
<
Uri
>[
mainUri
];
expectedUpdatedUris
??=
<
String
>[
expectedMainUri
];
final
Future
<
CompilerOutput
>
recompileFuture
=
generator
.
recompile
(
final
Future
<
CompilerOutput
?
>
recompileFuture
=
generator
.
recompile
(
mainUri
,
updatedUris
,
outputPath:
'/build/'
,
...
...
@@ -425,8 +423,8 @@ Future<void> _recompile(
scheduleMicrotask
(()
{
LineSplitter
.
split
(
mockCompilerOutput
).
forEach
(
stdoutHandler
.
handler
);
});
final
CompilerOutput
output
=
await
recompileFuture
;
expect
(
output
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
final
CompilerOutput
?
output
=
await
recompileFuture
;
expect
(
output
?
.
outputFilename
,
equals
(
'/path/to/main.dart.dill'
));
final
String
commands
=
frontendServerStdIn
.
getAndClear
();
final
RegExp
whitespace
=
RegExp
(
r'\s+'
);
final
List
<
String
>
parts
=
commands
.
split
(
whitespace
);
...
...
@@ -459,11 +457,11 @@ Future<void> _reject(
)
async
{
// Put content into the output stream after generator.recompile gets
// going few lines below, resets completer.
final
Future
<
CompilerOutput
>
rejectFuture
=
generator
.
reject
();
final
Future
<
CompilerOutput
?
>
rejectFuture
=
generator
.
reject
();
scheduleMicrotask
(()
{
LineSplitter
.
split
(
mockCompilerOutput
).
forEach
(
stdoutHandler
.
handler
);
});
final
CompilerOutput
output
=
await
rejectFuture
;
final
CompilerOutput
?
output
=
await
rejectFuture
;
expect
(
output
,
isNull
);
final
String
commands
=
frontendServerStdIn
.
getAndClear
();
...
...
packages/flutter_tools/test/general.shard/compile_test.dart
View file @
4bcf8fb4
...
...
@@ -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:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -19,10 +17,10 @@ void main() {
expect
(
stdoutHandler
.
boundaryKey
,
'12345'
);
stdoutHandler
.
handler
(
'12345'
);
stdoutHandler
.
handler
(
'12345 message 0'
);
final
CompilerOutput
output
=
await
stdoutHandler
.
compilerOutput
.
future
;
expect
(
output
.
errorCount
,
0
);
expect
(
output
.
outputFilename
,
'message'
);
expect
(
output
.
expressionData
,
null
);
final
CompilerOutput
?
output
=
await
stdoutHandler
.
compilerOutput
?
.
future
;
expect
(
output
?
.
errorCount
,
0
);
expect
(
output
?
.
outputFilename
,
'message'
);
expect
(
output
?
.
expressionData
,
null
);
});
testWithoutContext
(
'StdoutHandler can read output bytes'
,
()
async
{
...
...
@@ -35,11 +33,11 @@ void main() {
expect
(
stdoutHandler
.
boundaryKey
,
'12345'
);
stdoutHandler
.
handler
(
'12345'
);
stdoutHandler
.
handler
(
'12345 message 0'
);
final
CompilerOutput
output
=
await
stdoutHandler
.
compilerOutput
.
future
;
final
CompilerOutput
?
output
=
await
stdoutHandler
.
compilerOutput
?
.
future
;
expect
(
output
.
errorCount
,
0
);
expect
(
output
.
outputFilename
,
'message'
);
expect
(
output
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
expect
(
output
?
.
errorCount
,
0
);
expect
(
output
?
.
outputFilename
,
'message'
);
expect
(
output
?
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
});
testWithoutContext
(
'StdoutHandler reads output bytes if errorCount > 0'
,
()
async
{
...
...
@@ -52,11 +50,11 @@ void main() {
expect
(
stdoutHandler
.
boundaryKey
,
'12345'
);
stdoutHandler
.
handler
(
'12345'
);
stdoutHandler
.
handler
(
'12345 message 1'
);
final
CompilerOutput
output
=
await
stdoutHandler
.
compilerOutput
.
future
;
final
CompilerOutput
?
output
=
await
stdoutHandler
.
compilerOutput
?
.
future
;
expect
(
output
.
errorCount
,
1
);
expect
(
output
.
outputFilename
,
'message'
);
expect
(
output
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
expect
(
output
?
.
errorCount
,
1
);
expect
(
output
?
.
outputFilename
,
'message'
);
expect
(
output
?
.
expressionData
,
<
int
>[
1
,
2
,
3
,
4
]);
});
testWithoutContext
(
'TargetModel values'
,
()
{
...
...
@@ -72,7 +70,7 @@ void main() {
expect
(
TargetModel
(
'dartdevc'
),
TargetModel
.
dartdevc
);
expect
(
TargetModel
.
dartdevc
.
toString
(),
'dartdevc'
);
expect
(()
=>
TargetModel
(
'foobar'
),
throws
AssertionError
);
expect
(()
=>
TargetModel
(
'foobar'
),
throws
Exception
);
});
testWithoutContext
(
'toMultiRootPath maps different URIs'
,
()
async
{
...
...
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