Fix formatting of Flex error message (#16498)

This commit is contained in:
Ian Hickson 2018-04-12 21:16:39 -07:00 committed by GitHub
parent 0260642fc5
commit 1c3f6a851f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -681,7 +681,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (node != null) {
information.writeln('The nearest ancestor providing an unbounded width constraint is:');
information.write(' ');
information.write(node.toStringShallow(joiner: '\n '));
information.writeln(node.toStringShallow(joiner: '\n '));
}
information.writeln('See also: https://flutter.io/layout/');
addendum = information.toString();

View File

@ -110,4 +110,34 @@ void main() {
),
);
});
testWidgets('Error information is printed correctly', (WidgetTester tester) async {
// We run this twice, the first time without an error, so that the second time
// we only get a single exception. Otherwise we'd get two, the one we want and
// an extra one when we discover we never computed a size.
await tester.pumpWidget(
new Column(
children: <Widget>[
new Column(),
],
),
Duration.zero,
EnginePhase.layout,
);
await tester.pumpWidget(
new Column(
children: <Widget>[
new Column(
children: <Widget>[
new Expanded(child: new Container()),
],
),
],
),
Duration.zero,
EnginePhase.layout,
);
final String message = tester.takeException().toString();
expect(message, contains('\nSee also:'));
});
}