mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-16 04:38:42 +08:00
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.
25 lines
459 B
Dart
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'),
|
|
);
|
|
});
|
|
});
|
|
}
|