Add printSeparator() util
This commit is contained in:
parent
f9bce227ba
commit
c1c13ddf68
4 changed files with 18 additions and 5 deletions
|
@ -13,4 +13,5 @@ dependencies:
|
|||
dev_dependencies:
|
||||
angel_orm_test:
|
||||
path: ../angel_orm_test
|
||||
pretty_logging: ^1.0.0
|
||||
test: ^1.0.0
|
|
@ -1,14 +1,13 @@
|
|||
import 'package:angel_orm_test/angel_orm_test.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:pretty_logging/pretty_logging.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
Logger.root.onRecord.listen((rec) {
|
||||
print(rec);
|
||||
if (rec.error != null) print(rec.error);
|
||||
if (rec.stackTrace != null) print(rec.stackTrace);
|
||||
});
|
||||
Logger.root
|
||||
..level = Level.ALL
|
||||
..onRecord.listen(prettyLog);
|
||||
|
||||
group('postgresql', () {
|
||||
group('belongsTo',
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'package:angel_orm/angel_orm.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'models/book.dart';
|
||||
import 'util.dart';
|
||||
|
||||
belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
|
||||
{FutureOr<void> Function(QueryExecutor) close}) {
|
||||
|
@ -152,6 +153,7 @@ belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
|
|||
// we test both a query that return empty, and one
|
||||
// that should return correctly.
|
||||
test('returns empty on false subquery', () async {
|
||||
printSeparator('False subquery test');
|
||||
var query = BookQuery()..author.where.name.equals('Billie Jean');
|
||||
expect(await query.get(executor), isEmpty);
|
||||
});
|
||||
|
|
11
angel_orm_test/lib/src/util.dart
Normal file
11
angel_orm_test/lib/src/util.dart
Normal file
|
@ -0,0 +1,11 @@
|
|||
import 'dart:io';
|
||||
|
||||
void printSeparator(String title) {
|
||||
var b = StringBuffer(title.toUpperCase());
|
||||
for (int i = b.length; i < stdout.terminalColumns; i++) {
|
||||
b.write('=');
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
print(b);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue