Files
flame/packages/flame_test/test/fails_assert_test.dart
Pasha Stetsenko af45ea6cc4 feat: Added closeToVector in flame_test (#1245)
Added matcher closeToVector to help test equality of vectors. This matcher

    follows standard Flutter convention for writing tests as expect(value, matcher);
    provides meaningful description of the mismatch in case the test fails.

Also: fixed the name of the fails_assert_test, which wasn't running automatically because the file name did not end with _test.
2021-12-18 18:32:16 +00:00

25 lines
459 B
Dart

import 'package:flame_test/flame_test.dart';
import 'package:test/test.dart';
void main() {
group('failsAssert', () {
test('without message', () {
expect(
() {
assert(2 + 2 == 5);
},
failsAssert(),
);
});
test('with message', () {
expect(
() {
assert(2 + 2 == 5, 'Basic arithmetic error');
},
failsAssert('Basic arithmetic error'),
);
});
});
}