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
c5a3ee7f
Unverified
Commit
c5a3ee7f
authored
Apr 22, 2021
by
Alexandre Ardhuin
Committed by
GitHub
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add trailing commas in flutter/test/{foundation,gestures} (#80926)
parent
7769b000
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
142 deletions
+138
-142
assertions_test.dart
packages/flutter/test/foundation/assertions_test.dart
+7
-6
change_notifier_test.dart
packages/flutter/test/foundation/change_notifier_test.dart
+31
-29
collections_test.dart
packages/flutter/test/foundation/collections_test.dart
+4
-3
consolidate_response_test.dart
...es/flutter/test/foundation/consolidate_response_test.dart
+2
-4
diagnostics_test.dart
packages/flutter/test/foundation/diagnostics_test.dart
+76
-76
error_reporting_test.dart
packages/flutter/test/foundation/error_reporting_test.dart
+7
-6
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+4
-4
gesture_binding_test.dart
packages/flutter/test/gestures/gesture_binding_test.dart
+7
-14
No files found.
packages/flutter/test/foundation/assertions_test.dart
View file @
c5a3ee7f
...
...
@@ -71,7 +71,7 @@ void main() {
'The null value was thrown CONTEXTING.
\n
'
'
\n
'
'INFO
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
expect
(
FlutterErrorDetails
(
...
...
@@ -116,7 +116,7 @@ void main() {
FlutterErrorDetails
(
exception:
NullThrownError
()).
toString
(),
'══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞══════════════════════
\n
'
'The null value was thrown.
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
});
...
...
@@ -138,7 +138,7 @@ void main() {
FlutterError
error
=
FlutterError
(
'My Error Summary.
\n
'
'My first description.
\n
'
'My second description.'
'My second description.'
,
);
expect
(
error
.
diagnostics
.
length
,
equals
(
3
));
expect
(
error
.
diagnostics
[
0
].
level
,
DiagnosticLevel
.
summary
);
...
...
@@ -159,7 +159,7 @@ void main() {
'My Error Summary.
\n
'
'My first description.
\n
'
'My second description.
\n
'
'
\n
'
'
\n
'
,
);
expect
(
error
.
diagnostics
.
length
,
equals
(
5
));
...
...
@@ -185,7 +185,7 @@ void main() {
'My Error Summary.
\n
'
'My first description.
\n
'
'
\n
'
'My second description.'
'My second description.'
,
);
expect
(
error
.
diagnostics
.
length
,
equals
(
4
));
expect
(
error
.
diagnostics
[
0
].
level
,
DiagnosticLevel
.
summary
);
...
...
@@ -238,7 +238,8 @@ void main() {
final
AssertionError
error
;
try
{
throw
FlutterError
.
fromParts
(<
DiagnosticsNode
>[
(
ErrorDescription
(
'Error description without a summary'
))]);
ErrorDescription
(
'Error description without a summary'
),
]);
}
on
AssertionError
catch
(
e
)
{
error
=
e
;
}
...
...
packages/flutter/test/foundation/change_notifier_test.dart
View file @
c5a3ee7f
...
...
@@ -172,8 +172,7 @@ void main() {
log
.
clear
();
});
test
(
'During notifyListeners, a listener was added and removed immediately'
,
()
{
test
(
'During notifyListeners, a listener was added and removed immediately'
,
()
{
final
TestNotifier
source
=
TestNotifier
();
final
List
<
String
>
log
=
<
String
>[];
...
...
@@ -201,7 +200,8 @@ void main() {
test
(
'If a listener in the middle of the list of listeners removes itself, '
'notifyListeners still notifies all listeners'
,
()
{
'notifyListeners still notifies all listeners'
,
()
{
final
TestNotifier
source
=
TestNotifier
();
final
List
<
String
>
log
=
<
String
>[];
...
...
@@ -221,11 +221,10 @@ void main() {
source
.
notify
();
expect
(
log
,
<
String
>[
'listener1'
,
'selfRemovingListener'
,
'listener1'
]);
});
},
);
test
(
'If the first listener removes itself, notifyListeners still notify all listeners'
,
()
{
test
(
'If the first listener removes itself, notifyListeners still notify all listeners'
,
()
{
final
TestNotifier
source
=
TestNotifier
();
final
List
<
String
>
log
=
<
String
>[];
...
...
@@ -458,10 +457,13 @@ void main() {
expect
(
error
!,
isFlutterError
);
expect
(
error
.
toStringDeep
(),
equalsIgnoringHashCodes
(
'FlutterError
\n
'
equalsIgnoringHashCodes
(
'FlutterError
\n
'
' A TestNotifier was used after being disposed.
\n
'
' Once you have called dispose() on a TestNotifier, it can no
\n
'
' longer be used.
\n
'
));
' longer be used.
\n
'
,
),
);
});
test
(
'notifyListener can be called recursively'
,
()
{
...
...
@@ -524,7 +526,7 @@ void main() {
8
,
9
,
10
,
11
11
,
];
final
List
<
String
>
expectedLog
=
remainingListenerIndexes
.
map
((
int
i
)
=>
'listener
$i
'
).
toList
();
...
...
packages/flutter/test/foundation/collections_test.dart
View file @
c5a3ee7f
...
...
@@ -82,7 +82,9 @@ void main() {
// collisions are guaranteed. These should be sorted so that the 'order'
// part of the objects are still in order.
final
List
<
OrderedComparable
>
list
=
List
<
OrderedComparable
>.
generate
(
size
,
(
int
i
)
=>
OrderedComparable
(
random
.
nextInt
(
size
>>
2
),
i
));
size
,
(
int
i
)
=>
OrderedComparable
(
random
.
nextInt
(
size
>>
2
),
i
),
);
mergeSort
(
list
);
OrderedComparable
prev
=
list
[
0
];
for
(
int
i
=
1
;
i
<
size
;
i
++)
{
...
...
@@ -121,8 +123,7 @@ void main() {
test
(
'MergeSortSpecialCases'
,
()
{
for
(
final
int
size
in
<
int
>[
511
,
512
,
513
])
{
// All equal.
final
List
<
OrderedComparable
>
list
=
List
<
OrderedComparable
>.
generate
(
size
,
(
int
i
)
=>
OrderedComparable
(
0
,
i
));
final
List
<
OrderedComparable
>
list
=
List
<
OrderedComparable
>.
generate
(
size
,
(
int
i
)
=>
OrderedComparable
(
0
,
i
));
mergeSort
(
list
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
expect
(
list
[
i
].
order
,
equals
(
i
));
...
...
packages/flutter/test/foundation/consolidate_response_test.dart
View file @
c5a3ee7f
...
...
@@ -166,16 +166,14 @@ class MockHttpClientResponse extends Fake implements HttpClientResponse {
@override
StreamSubscription
<
List
<
int
>>
listen
(
void
Function
(
List
<
int
>
event
)?
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
?
cancelOnError
})
{
if
(
error
!=
null
)
{
return
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
error
(
error
as
Object
)).
listen
(
return
Stream
<
List
<
int
>>.
fromFuture
(
Future
<
List
<
int
>>.
error
(
error
as
Object
)).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
cancelOnError:
cancelOnError
,
);
}
return
Stream
<
List
<
int
>>.
fromIterable
(
<
List
<
int
>>[
chunkOne
,
chunkTwo
]).
listen
(
return
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
chunkOne
,
chunkTwo
]).
listen
(
onData
,
onDone:
onDone
,
onError:
onError
,
...
...
packages/flutter/test/foundation/diagnostics_test.dart
View file @
c5a3ee7f
...
...
@@ -905,8 +905,8 @@ void main() {
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
'The provided object "Hello World" is not an enum.'
)
,
),
'The provided object "Hello World" is not an enum.'
,
)
)
,
);
});
...
...
@@ -1882,7 +1882,7 @@ void main() {
final
StackTrace
stack
=
StackTrace
.
fromString
(
'#0 someMethod (file:///diagnostics_test.dart:42:19)
\n
'
'#1 someMethod2 (file:///diagnostics_test.dart:12:3)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
,
);
expect
(
...
...
@@ -1891,7 +1891,7 @@ void main() {
'Stack trace:
\n
'
'#0 someMethod (file:///diagnostics_test.dart:42:19)
\n
'
'#1 someMethod2 (file:///diagnostics_test.dart:12:3)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
,
),
);
...
...
@@ -1901,7 +1901,7 @@ void main() {
'-- callback 2 --
\n
'
'#0 someMethod (file:///diagnostics_test.dart:42:19)
\n
'
'#1 someMethod2 (file:///diagnostics_test.dart:12:3)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
'#2 someMethod3 (file:///foo.dart:4:1)
\n
'
,
),
);
});
...
...
@@ -2164,7 +2164,7 @@ void main() {
' [1.0, 0.0, 0.0, 1.0]
\n
'
' --- example property at max length --
\n
'
' diagnosis: insufficient data to draw
\n
'
' conclusion (less than five repaints)
\n
'
' conclusion (less than five repaints)
\n
'
,
),
);
...
...
@@ -2239,7 +2239,7 @@ void main() {
'diagnosis:
\n
'
' insufficient data to draw conclusion
\n
'
' (less than five repaints)
\n
'
'════════════════════════════════════════
\n
'
'════════════════════════════════════════
\n
'
,
),
);
});
...
...
packages/flutter/test/foundation/error_reporting_test.dart
View file @
c5a3ee7f
...
...
@@ -78,7 +78,7 @@ Future<void> main() async {
r'#0 getSampleStack\.<anonymous closure> \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'#2 getSampleStack \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'#3 main \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'(.+\n)+'
// TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
r'(.+\n)+'
,
// TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
));
console
.
clear
();
FlutterError
.
dumpErrorToConsole
(
FlutterErrorDetails
(
...
...
@@ -145,7 +145,7 @@ Future<void> main() async {
r'#0 getSampleStack\.<anonymous closure> \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'#2 getSampleStack \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'#3 main \([^)]+flutter/test/foundation/error_reporting_test\.dart:[0-9]+:[0-9]+\)\n'
r'(.+\n)+'
// TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
r'(.+\n)+'
,
// TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
));
console
.
clear
();
FlutterError
.
dumpErrorToConsole
(
FlutterErrorDetails
(
...
...
@@ -158,8 +158,7 @@ Future<void> main() async {
test
(
'Error reporting - NoSuchMethodError'
,
()
async
{
expect
(
console
,
isEmpty
);
final
Object
exception
=
NoSuchMethodError
.
withInvocation
(
5
,
Invocation
.
method
(
#foo
,
<
dynamic
>[
2
,
4
]));
final
Object
exception
=
NoSuchMethodError
.
withInvocation
(
5
,
Invocation
.
method
(
#foo
,
<
dynamic
>[
2
,
4
]));
FlutterError
.
dumpErrorToConsole
(
FlutterErrorDetails
(
exception:
exception
,
...
...
@@ -174,8 +173,10 @@ Future<void> main() async {
FlutterError
.
dumpErrorToConsole
(
FlutterErrorDetails
(
exception:
exception
,
));
expect
(
console
.
join
(
'
\n
'
),
'Another exception was thrown: NoSuchMethodError: int has no foo method accepting arguments (_, _)'
);
expect
(
console
.
join
(
'
\n
'
),
'Another exception was thrown: NoSuchMethodError: int has no foo method accepting arguments (_, _)'
,
);
console
.
clear
();
FlutterError
.
resetErrorCount
();
});
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
c5a3ee7f
...
...
@@ -245,7 +245,7 @@ void main() {
r' window size: Size\(2400\.0, 1800\.0\) \(in physical pixels\)\n'
r' device pixel ratio: 3\.0 \(physical pixels per logical pixel\)\n'
r' configuration: Size\(800\.0, 600\.0\) at 3\.0x \(in logical pixels\)\n'
r'$'
r'$'
,
),
});
});
...
...
@@ -267,7 +267,7 @@ void main() {
r' \[1] 0\.0,3\.0,0\.0,0\.0\n'
r' \[2] 0\.0,0\.0,1\.0,0\.0\n'
r' \[3] 0\.0,0\.0,0\.0,1\.0\n'
r'$'
r'$'
,
),
});
});
...
...
@@ -277,7 +277,7 @@ void main() {
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInTraversalOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'data'
:
'Semantics not collected.'
'data'
:
'Semantics not collected.'
,
});
});
...
...
@@ -286,7 +286,7 @@ void main() {
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInInverseHitTestOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'data'
:
'Semantics not collected.'
'data'
:
'Semantics not collected.'
,
});
});
...
...
packages/flutter/test/gestures/gesture_binding_test.dart
View file @
c5a3ee7f
...
...
@@ -92,8 +92,7 @@ void main() {
expect
(
events
[
0
],
isA
<
PointerHoverEvent
>());
expect
(
events
[
1
],
isA
<
PointerHoverEvent
>());
expect
(
events
[
2
],
isA
<
PointerHoverEvent
>());
expect
(
pointerRouterEvents
.
length
,
6
,
reason:
'pointerRouterEvents contains:
$pointerRouterEvents
'
);
expect
(
pointerRouterEvents
.
length
,
6
,
reason:
'pointerRouterEvents contains:
$pointerRouterEvents
'
);
expect
(
pointerRouterEvents
[
0
],
isA
<
PointerAddedEvent
>());
expect
(
pointerRouterEvents
[
1
],
isA
<
PointerHoverEvent
>());
expect
(
pointerRouterEvents
[
2
],
isA
<
PointerHoverEvent
>());
...
...
@@ -151,8 +150,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
5
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
@@ -170,8 +168,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
2
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
@@ -191,8 +188,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
5
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
@@ -224,8 +220,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
5
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
@@ -254,8 +249,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
5
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
@@ -285,8 +279,7 @@ void main() {
],
);
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
final
List
<
PointerEvent
>
events
=
PointerEventConverter
.
expand
(
packet
.
data
,
ui
.
window
.
devicePixelRatio
).
toList
();
expect
(
events
.
length
,
5
);
expect
(
events
[
0
],
isA
<
PointerAddedEvent
>());
...
...
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