blob: 2af81950e54de83c96f101b688d2046e52fcee88 [file] [edit]
import 'package:matcher/expect.dart';
import 'package:test/scaffolding.dart';
void main() {
test('throwsArgumentError', () {
// This check succeeds.
expect(() => throw ArgumentError('bad'), throwsArgumentError);
// This check fails, the function returned instead of throwing.
expect(() => 42, throwsArgumentError);
// Expected: throws <Instance of 'ArgumentError'>
// Actual: <Closure: () => int>
// Which: returned <42>
});
}