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
00dfa224
Commit
00dfa224
authored
Apr 13, 2017
by
Ian Hickson
Committed by
GitHub
Apr 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more consistent about how stack traces are output from flutter_test (#9361)
parent
62613ddf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
2 deletions
+97
-2
exception_handling_expectation.txt
...ted_tests/flutter_test/exception_handling_expectation.txt
+58
-0
exception_handling_test.dart
...automated_tests/flutter_test/exception_handling_test.dart
+18
-0
binding.dart
packages/flutter_test/lib/src/binding.dart
+11
-2
pubspec.yaml
packages/flutter_test/pubspec.yaml
+5
-0
test_test.dart
packages/flutter_tools/test/test_test.dart
+5
-0
No files found.
dev/automated_tests/flutter_test/exception_handling_expectation.txt
0 → 100644
View file @
00dfa224
[^═]*(this line contains the test framework's output with the clock and so forth)?
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following message was thrown running a test:
Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack:
#0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:10:5\)
<asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>>
^\(elided [0-9]+ .+[^)]$
^.+\)$
The test description was:
Exception handling in test harness - string
════════════════════════════════════════════════════════════════════════════════════════════════════
.*(this line has more of the test framework's output)?
Test failed\. See exception logs above\.
*
[^═]*(this line contains the test framework's output with the clock and so forth)?
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack:
#0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:13:5\)
<asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>>
^\(elided [0-9]+ .+[^)]$
^.+\)$
The test description was:
Exception handling in test harness - FlutterError
════════════════════════════════════════════════════════════════════════════════════════════════════
.*(this line has more of the test framework's output)?
Test failed\. See exception logs above\.
*
[^═]*(this line contains the test framework's output with the clock and so forth)?
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following message was thrown running a test:
Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack:
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:9\)
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:105\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>>
^\(elided [0-9]+ .+[^)]$
^.+\)$
The test description was:
Exception handling in test harness - uncaught Future error
════════════════════════════════════════════════════════════════════════════════════════════════════
.*(this line has more of the test framework's output)?
Test failed\. See exception logs above\.
*
.*..:.. \+0 -3: Some tests failed\. *
dev/automated_tests/flutter_test/exception_handling_test.dart
0 → 100644
View file @
00dfa224
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Exception handling in test harness - string'
,
(
WidgetTester
tester
)
async
{
throw
'Who lives, who dies, who tells your story?'
;
});
testWidgets
(
'Exception handling in test harness - FlutterError'
,
(
WidgetTester
tester
)
async
{
throw
new
FlutterError
(
'Who lives, who dies, who tells your story?'
);
});
testWidgets
(
'Exception handling in test harness - uncaught Future error'
,
(
WidgetTester
tester
)
async
{
new
Future
<
Null
>.
error
(
'Who lives, who dies, who tells your story?'
);
});
}
packages/flutter_test/lib/src/binding.dart
View file @
00dfa224
...
...
@@ -18,6 +18,7 @@ import 'package:meta/meta.dart';
import
'package:quiver/testing/async.dart'
;
import
'package:quiver/time.dart'
;
import
'package:test/test.dart'
as
test_package
;
import
'package:stack_trace/stack_trace.dart'
as
stack_trace
;
import
'package:vector_math/vector_math_64.dart'
;
import
'stack_manipulation.dart'
;
...
...
@@ -353,7 +354,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
// will see them in the logs at some point.
FlutterError
.
dumpErrorToConsole
(
new
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
stack:
_unmangle
(
stack
)
,
context:
'running a test (but after the test had completed)'
,
library
:
'Flutter test framework'
),
forceReport:
true
);
...
...
@@ -394,7 +395,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
final
int
stackLinesToOmit
=
reportExpectCall
(
stack
,
expectLine
);
FlutterError
.
reportError
(
new
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
stack:
_unmangle
(
stack
)
,
context:
'running a test'
,
library
:
'Flutter test framework'
,
stackFilter:
(
Iterable
<
String
>
frames
)
{
...
...
@@ -1021,3 +1022,11 @@ class _EmptyStack implements StackTrace {
@override
String
toString
()
=>
''
;
}
StackTrace
_unmangle
(
StackTrace
stack
)
{
if
(
stack
is
stack_trace
.
Trace
)
return
stack
.
vmTrace
;
if
(
stack
is
stack_trace
.
Chain
)
return
stack
.
toTrace
().
vmTrace
;
return
stack
;
}
packages/flutter_test/pubspec.yaml
View file @
00dfa224
...
...
@@ -9,3 +9,8 @@ dependencies:
flutter
:
sdk
:
flutter
# We import stack_trace because the test packages uses it and we
# need to be able to unmangle the stack traces that it passed to
# stack_trace. See https://github.com/dart-lang/test/issues/590
stack_trace
:
any
# use version expected by test package
packages/flutter_tools/test/test_test.dart
View file @
00dfa224
...
...
@@ -23,6 +23,11 @@ void main() {
final
String
automatedTestsDirectory
=
fs
.
path
.
join
(
'..'
,
'..'
,
'dev'
,
'automated_tests'
);
final
String
flutterTestDirectory
=
fs
.
path
.
join
(
automatedTestsDirectory
,
'flutter_test'
);
testUsingContext
(
'Exception handling in test harness'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
return
_testFile
(
'exception_handling'
,
automatedTestsDirectory
,
flutterTestDirectory
);
});
testUsingContext
(
'TestAsyncUtils guarded function test'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
return
_testFile
(
'test_async_utils_guarded'
,
automatedTestsDirectory
,
flutterTestDirectory
);
...
...
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