Add printSeparator() util

This commit is contained in:
Tobe O 2019-10-09 10:36:55 -04:00
parent f9bce227ba
commit c1c13ddf68
4 changed files with 18 additions and 5 deletions

View file

@ -13,4 +13,5 @@ dependencies:
dev_dependencies: dev_dependencies:
angel_orm_test: angel_orm_test:
path: ../angel_orm_test path: ../angel_orm_test
pretty_logging: ^1.0.0
test: ^1.0.0 test: ^1.0.0

View file

@ -1,14 +1,13 @@
import 'package:angel_orm_test/angel_orm_test.dart'; import 'package:angel_orm_test/angel_orm_test.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:pretty_logging/pretty_logging.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'common.dart'; import 'common.dart';
void main() { void main() {
Logger.root.onRecord.listen((rec) { Logger.root
print(rec); ..level = Level.ALL
if (rec.error != null) print(rec.error); ..onRecord.listen(prettyLog);
if (rec.stackTrace != null) print(rec.stackTrace);
});
group('postgresql', () { group('postgresql', () {
group('belongsTo', group('belongsTo',

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:angel_orm/angel_orm.dart'; import 'package:angel_orm/angel_orm.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'models/book.dart'; import 'models/book.dart';
import 'util.dart';
belongsToTests(FutureOr<QueryExecutor> Function() createExecutor, belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
{FutureOr<void> Function(QueryExecutor) close}) { {FutureOr<void> Function(QueryExecutor) close}) {
@ -152,6 +153,7 @@ belongsToTests(FutureOr<QueryExecutor> Function() createExecutor,
// we test both a query that return empty, and one // we test both a query that return empty, and one
// that should return correctly. // that should return correctly.
test('returns empty on false subquery', () async { test('returns empty on false subquery', () async {
printSeparator('False subquery test');
var query = BookQuery()..author.where.name.equals('Billie Jean'); var query = BookQuery()..author.where.name.equals('Billie Jean');
expect(await query.get(executor), isEmpty); expect(await query.get(executor), isEmpty);
}); });

View 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);
}
}