test_async_utils_unguarded_test.dart 790 Bytes
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'package:flutter/foundation.dart';
6 7
import 'package:flutter_test/flutter_test.dart';

8 9 10
class TestTestBinding extends AutomatedTestWidgetsFlutterBinding {
  @override
  DebugPrintCallback get debugPrintOverride => testPrint;
Michael Goderbauer's avatar
Michael Goderbauer committed
11
  static void testPrint(String? message, { int? wrapWidth }) { print(message); }
12 13
}

14
Future<void> helperFunction(WidgetTester tester) async {
15 16 17 18
  await tester.pump();
}

void main() {
19
  TestTestBinding();
20 21 22 23 24 25
  testWidgets('TestAsyncUtils - handling unguarded async helper functions', (WidgetTester tester) async {
    helperFunction(tester);
    helperFunction(tester);
    // this should fail
  });
}