minimal_test 0.2.0 copy "minimal_test: ^0.2.0" to clipboard
minimal_test: ^0.2.0 copied to clipboard

Minimalist library for testing Dart VM scripts using null-safety features.

example/README.md

Minimal Test - Example #

Build Status

Asynchronous Tests #

While it is possible to run asynchronous tests, it is recommended to await the completion of the objects being tested before issuing a call to group, test, and expect. Otherwise, the output of expect might not occur on the right line making the test-report difficult to read. Nevertheless, the total number of failed/passed tests is reported correctly.

File async_test.dart shows how to test the result of a future calculation:

import 'dart:async';

import 'package:minimal_test/minimal_test.dart';

Future<T> later<T>(
  T t, {
  Duration duration = const Duration(microseconds: 100),
}) {
  return Future.delayed(duration, () => t);
}

Future<void> main() async {
  final a = [await later(17), await later(27)];

  group('int', () {
    test('17', () {
      expect(a[0], 17);
    });

    test('27', () {
      expect(a[1], 27);
    });
  });

  final b = [
    await later(
      'seventeen',
      duration: Duration(
        microseconds: 230,
      ),
    ),
    await later('twentyseven'),
  ];

  group('Await in expect', () {
    test('seventeen', () {
      expect(b[0], 'seventeen');
    });
    test('twentyseven', () {
      expect(b[1], 'twentyseven');
    });
  });
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0
likes
140
pub points
0%
popularity

Publisher

verified publishersimphotonics.com

Minimalist library for testing Dart VM scripts using null-safety features.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on minimal_test