test_async_utils_unguarded_test.dart 789 Bytes
Newer Older
1 2 3 4
// Copyright 2016 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.

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

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

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
  });
}