Files
drift/sqlparser/test/utils/ast_quality_test.dart
Peter Leibiger ab20d69846 Fix broken iterable comparison in sqlparser
* this results in false positive migration tests, not sure what else could be effected
2021-12-02 13:10:53 +01:00

74 lines
1.5 KiB
Dart

import 'package:sqlparser/sqlparser.dart';
import 'package:sqlparser/src/utils/ast_equality.dart';
import 'package:test/expect.dart';
import 'package:test/scaffolding.dart';
void main() {
group(enforceEqualIterable, () {
test('should accept 2 equal iterables', () {
enforceEqualIterable(
[
NotNull('foo'),
],
[
NotNull('foo'),
],
);
});
test('should throw if only first is empty', () {
expect(
() => enforceEqualIterable(
[],
[
NotNull('foo'),
],
),
throwsA(isA<ArgumentError>()),
);
});
test('should throw if only second is empty', () {
expect(
() => enforceEqualIterable(
[
NotNull('foo'),
],
[],
),
throwsA(isA<ArgumentError>()),
);
});
test('should throw if first is shorter', () {
expect(
() => enforceEqualIterable(
[
NotNull('foo'),
],
[
NotNull('foo'),
UniqueColumn('foo', null),
],
),
throwsA(isA<ArgumentError>()),
);
});
test('should throw if second is shorter', () {
expect(
() => enforceEqualIterable(
[
NotNull('foo'),
UniqueColumn('foo', null),
],
[
NotNull('foo'),
],
),
throwsA(isA<ArgumentError>()),
);
});
});
}