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
ec14cef0
Unverified
Commit
ec14cef0
authored
Apr 08, 2021
by
Jenn Magder
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate more tool unit tests to null safety (#80002)
parent
aa96eb29
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
21 additions
and
44 deletions
+21
-44
language_version.dart
packages/flutter_tools/lib/src/dart/language_version.dart
+1
-1
proxy_validator_test.dart
...ls/test/commands.shard/hermetic/proxy_validator_test.dart
+0
-2
build_validation_test.dart
...ols/test/general.shard/android/build_validation_test.dart
+0
-2
build_info_test.dart
...ges/flutter_tools/test/general.shard/build_info_test.dart
+5
-8
depfile_test.dart
...r_tools/test/general.shard/build_system/depfile_test.dart
+2
-4
common_test.dart
packages/flutter_tools/test/general.shard/common_test.dart
+0
-2
language_version_test.dart
..._tools/test/general.shard/dart/language_version_test.dart
+0
-2
flutter_project_metadata_test.dart
...ols/test/general.shard/flutter_project_metadata_test.dart
+3
-5
linux_doctor_test.dart
...ter_tools/test/general.shard/linux/linux_doctor_test.dart
+1
-1
event_printer_test.dart
...ter_tools/test/general.shard/test/event_printer_test.dart
+2
-4
time_test.dart
packages/flutter_tools/test/general.shard/time_test.dart
+2
-4
utils_test.dart
packages/flutter_tools/test/general.shard/utils_test.dart
+4
-6
vscode_test.dart
.../flutter_tools/test/general.shard/vscode/vscode_test.dart
+0
-2
visual_studio_test.dart
..._tools/test/general.shard/windows/visual_studio_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/dart/language_version.dart
View file @
ec14cef0
...
...
@@ -48,7 +48,7 @@ bool _inUnitTest() {
///
/// The specification for the language version tag is defined at:
/// https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/feature-specification.md#individual-library-language-version-override
LanguageVersion
determineLanguageVersion
(
File
file
,
Package
package
,
String
flutterRoot
)
{
LanguageVersion
determineLanguageVersion
(
File
file
,
Package
?
package
,
String
flutterRoot
)
{
int
blockCommentDepth
=
0
;
// If reading the file fails, default to a null-safe version. The
// command will likely fail later in the process with a better error
...
...
packages/flutter_tools/test/commands.shard/hermetic/proxy_validator_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/doctor_validator.dart'
;
import
'package:flutter_tools/src/proxy_validator.dart'
;
...
...
packages/flutter_tools/test/general.shard/android/build_validation_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/android/build_validation.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
...
...
packages/flutter_tools/test/general.shard/build_info_test.dart
View file @
ec14cef0
...
...
@@ -2,23 +2,20 @@
// 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:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'../src/common.dart'
;
void
main
(
)
{
BufferLogger
logger
;
late
BufferLogger
logger
;
setUp
(()
{
logger
=
BufferLogger
.
test
();
});
group
(
'Validate build number'
,
()
{
testWithoutContext
(
'CFBundleVersion for iOS'
,
()
async
{
String
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
'xyz'
,
logger
);
String
?
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
'xyz'
,
logger
);
expect
(
buildName
,
isNull
);
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
'0.0.1'
,
logger
);
expect
(
buildName
,
'0.0.1'
);
...
...
@@ -29,7 +26,7 @@ void main() {
});
testWithoutContext
(
'versionCode for Android'
,
()
async
{
String
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
android_arm
,
'123.abc+-'
,
logger
);
String
?
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
android_arm
,
'123.abc+-'
,
logger
);
expect
(
buildName
,
'123'
);
buildName
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
android_arm
,
'abc'
,
logger
);
expect
(
buildName
,
'1'
);
...
...
@@ -38,7 +35,7 @@ void main() {
group
(
'Validate build name'
,
()
{
testWithoutContext
(
'CFBundleShortVersionString for iOS'
,
()
async
{
String
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
ios
,
'xyz'
,
logger
);
String
?
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
ios
,
'xyz'
,
logger
);
expect
(
buildName
,
isNull
);
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
ios
,
'0.0.1'
,
logger
);
expect
(
buildName
,
'0.0.1'
);
...
...
@@ -52,7 +49,7 @@ void main() {
});
testWithoutContext
(
'versionName for Android'
,
()
async
{
String
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
android_arm
,
'123.abc+-'
,
logger
);
String
?
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
android_arm
,
'123.abc+-'
,
logger
);
expect
(
buildName
,
'123.abc+-'
);
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
android_arm
,
'abc+-'
,
logger
);
expect
(
buildName
,
'abc+-'
);
...
...
packages/flutter_tools/test/general.shard/build_system/depfile_test.dart
View file @
ec14cef0
...
...
@@ -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/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -12,8 +10,8 @@ import 'package:flutter_tools/src/build_system/depfile.dart';
import
'../../src/common.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
DepfileService
depfileService
;
late
FileSystem
fileSystem
;
late
DepfileService
depfileService
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
...
...
packages/flutter_tools/test/general.shard/common_test.dart
View file @
ec14cef0
...
...
@@ -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
'../src/common.dart'
;
void
main
(
)
{
...
...
packages/flutter_tools/test/general.shard/dart/language_version_test.dart
View file @
ec14cef0
...
...
@@ -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/memory.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/dart/language_version.dart'
;
...
...
packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/flutter_project_metadata.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
...
...
@@ -12,9 +10,9 @@ import 'package:file/memory.dart';
import
'../src/common.dart'
;
void
main
(
)
{
FileSystem
fileSystem
;
BufferLogger
logger
;
File
metadataFile
;
late
FileSystem
fileSystem
;
late
BufferLogger
logger
;
late
File
metadataFile
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
...
...
packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart
View file @
ec14cef0
...
...
@@ -9,7 +9,7 @@ import 'package:flutter_tools/src/doctor_validator.dart';
import
'package:flutter_tools/src/linux/linux_doctor.dart'
;
import
'../../src/common.dart'
;
import
'../../src/
context
.dart'
;
import
'../../src/
fake_process_manager
.dart'
;
// A command that will return typical-looking 'clang++ --version' output with
// the given version number.
...
...
packages/flutter_tools/test/general.shard/test/event_printer_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/test/event_printer.dart'
;
import
'package:flutter_tools/src/test/test_device.dart'
;
import
'package:test/fake.dart'
;
...
...
@@ -13,8 +11,8 @@ import '../../src/common.dart';
void
main
(
)
{
group
(
EventPrinter
,
()
{
final
Uri
observatoryUri
=
Uri
.
parse
(
'http://localhost:1234'
);
EventPrinter
eventPrinter
;
StringBuffer
output
;
late
EventPrinter
eventPrinter
;
late
StringBuffer
output
;
setUp
(()
{
output
=
StringBuffer
();
...
...
packages/flutter_tools/test/general.shard/time_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/base/time.dart'
;
import
'../src/common.dart'
;
...
...
@@ -29,9 +27,9 @@ void main() {
final
String
formattedTime
=
formatDateTime
(
time
);
// If a date time string has a timezone offset, DateTime.tryParse()
// converts the parsed time to UTC.
final
DateTime
parsedTime
=
DateTime
.
tryParse
(
formattedTime
);
final
DateTime
?
parsedTime
=
DateTime
.
tryParse
(
formattedTime
);
expect
(
parsedTime
,
isNotNull
);
expect
(
parsedTime
.
isUtc
,
isTrue
);
expect
(
parsedTime
!
.
isUtc
,
isTrue
);
// Convert the parsed time (which should be utc) to the local timezone and
// compare against the original time which is in the local timezone. They
// should be the same.
...
...
packages/flutter_tools/test/general.shard/utils_test.dart
View file @
ec14cef0
...
...
@@ -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:flutter_tools/src/base/utils.dart'
;
import
'package:flutter_tools/src/base/version.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
...
...
@@ -29,24 +27,24 @@ baz=qux
expect
(
Version
.
unknown
.
toString
(),
equals
(
'unknown'
));
expect
(
Version
(
null
,
null
,
null
).
toString
(),
equals
(
'0'
));
final
Version
v1
=
Version
.
parse
(
'1'
);
final
Version
v1
=
Version
.
parse
(
'1'
)
!
;
expect
(
v1
.
major
,
equals
(
1
));
expect
(
v1
.
minor
,
equals
(
0
));
expect
(
v1
.
patch
,
equals
(
0
));
expect
(
v1
,
greaterThan
(
Version
.
unknown
));
final
Version
v2
=
Version
.
parse
(
'1.2'
);
final
Version
v2
=
Version
.
parse
(
'1.2'
)
!
;
expect
(
v2
.
major
,
equals
(
1
));
expect
(
v2
.
minor
,
equals
(
2
));
expect
(
v2
.
patch
,
equals
(
0
));
final
Version
v3
=
Version
.
parse
(
'1.2.3'
);
final
Version
v3
=
Version
.
parse
(
'1.2.3'
)
!
;
expect
(
v3
.
major
,
equals
(
1
));
expect
(
v3
.
minor
,
equals
(
2
));
expect
(
v3
.
patch
,
equals
(
3
));
final
Version
v4
=
Version
.
parse
(
'1.12'
);
final
Version
v4
=
Version
.
parse
(
'1.12'
)
!
;
expect
(
v4
,
greaterThan
(
v2
));
expect
(
v3
,
greaterThan
(
v2
));
...
...
packages/flutter_tools/test/general.shard/vscode/vscode_test.dart
View file @
ec14cef0
...
...
@@ -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/memory.dart'
;
import
'package:flutter_tools/src/base/version.dart'
;
import
'package:flutter_tools/src/vscode/vscode.dart'
;
...
...
packages/flutter_tools/test/general.shard/windows/visual_studio_test.dart
View file @
ec14cef0
...
...
@@ -13,7 +13,7 @@ import 'package:flutter_tools/src/convert.dart';
import
'package:flutter_tools/src/windows/visual_studio.dart'
;
import
'../../src/common.dart'
;
import
'../../src/
context
.dart'
;
import
'../../src/
fake_process_manager
.dart'
;
const
String
programFilesPath
=
r'C:\Program Files (x86)'
;
const
String
visualStudioPath
=
programFilesPath
+
r'\Microsoft Visual Studio\2017\Community'
;
...
...
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