test_project.dart 770 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
// Copyright 2014 The Flutter 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 'project.dart';

class TestProject extends Project {

  @override
  final String pubspec = '''
  name: test
  environment:
13
    sdk: '>=3.2.0-0 <4.0.0'
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

  dependencies:
    flutter:
      sdk: flutter
  dev_dependencies:
    flutter_test:
      sdk: flutter
  ''';

  @override
  final String main = r'''
int foo(int bar) {
  return bar + 2;
}
  ''';

  @override
  final String test = r'''
  import 'package:flutter_test/flutter_test.dart';
  import 'package:test/main.dart';

  void main() {
    testWidgets('it can test', (WidgetTester tester) async {
      expect(foo(2), 4);
    });
  }
''';
}