Skip to content

Commit e3ca8c8

Browse files
committed
added encoding test for interval
1 parent 757d23f commit e3ca8c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/encoding_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ void main() {
183183
}
184184
});
185185

186+
test('interval', () async {
187+
await expectInverse(Duration(minutes: 15), PostgreSQLDataType.interval);
188+
await expectInverse(
189+
Duration(days: 1, minutes: 15), PostgreSQLDataType.interval);
190+
await expectInverse(
191+
-Duration(days: 1, seconds: 5), PostgreSQLDataType.interval);
192+
try {
193+
await conn.query('INSERT INTO t (v) VALUES (@v:interval)',
194+
substitutionValues: {'v': 'not-interval'});
195+
fail('unreachable');
196+
} on FormatException catch (e) {
197+
expect(e.toString(), contains('Expected: Duration'));
198+
}
199+
});
200+
186201
test('numeric', () async {
187202
final binaries = {
188203
'-123400000.20000': [

0 commit comments

Comments
 (0)