Skip to content

Commit

Permalink
Tests: drop notAtLeastDart2_15_0 checks, package requires it.
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrobot-team committed Oct 16, 2023
1 parent fa5b593 commit 2b4d47e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
12 changes: 6 additions & 6 deletions objectbox_test/test/box_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ void main() {
await store.runInTransactionAsync(TxMode.write, callback, simpleItems());
count = box.count();
expect(count, equals(6));
}, skip: notAtLeastDart2_15_0());
});

test('async txn - send and receive relations', () async {
final testBox = store.box<TestEntity>();
Expand Down Expand Up @@ -863,7 +863,7 @@ void main() {
object.relA.target;
object.relManyA.length;
}
}, skip: notAtLeastDart2_15_0());
});

test('failing transactions', () {
expect(
Expand Down Expand Up @@ -897,7 +897,7 @@ void main() {
}, simpleItems()),
throwsA('test-exception'));
expect(box.count(), equals(0));
}, skip: notAtLeastDart2_15_0());
});

test('recursive write in write transaction', () {
store.runInTransaction(TxMode.write, () {
Expand All @@ -923,7 +923,7 @@ void main() {
});
}, simpleItems());
expect(box.count(), equals(12));
}, skip: notAtLeastDart2_15_0());
});

test('recursive read in write transaction', () {
int count = store.runInTransaction(TxMode.write, () {
Expand All @@ -941,7 +941,7 @@ void main() {
return store.runInTransaction(TxMode.read, box.count);
}, simpleItems());
expect(count, equals(6));
}, skip: notAtLeastDart2_15_0());
});

test('recursive write in read -> fails during creation', () {
expect(
Expand All @@ -965,7 +965,7 @@ void main() {
}, simpleItems()),
throwsA(predicate((StateError e) => e.toString().contains(
'Bad state: failed to create transaction: Cannot start a write transaction inside a read only transaction (OBX_ERROR code 10001)'))));
}, skip: notAtLeastDart2_15_0());
});

test('failing in recursive txn', () {
store.runInTransaction(TxMode.write, () {
Expand Down
8 changes: 4 additions & 4 deletions objectbox_test/test/store_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void main() {
}
}
env.closeAndDelete();
}, skip: notAtLeastDart2_15_0());
});

test('store multi-open', () {
final stores = <Store>[];
Expand Down Expand Up @@ -323,7 +323,7 @@ void main() {
expect(x, 'foo!');
expect(env.box.count(), 0); // Must be removed once awaited
env.closeAndDelete();
}, skip: notAtLeastDart2_15_0());
});

test('store runAsync returns isolate error', () async {
final env = TestEnv('store');
Expand All @@ -334,7 +334,7 @@ void main() {
// expected
}
env.closeAndDelete();
}, skip: notAtLeastDart2_15_0());
});

test('store runAsync returns callback error', () async {
final env = TestEnv('store');
Expand All @@ -346,7 +346,7 @@ void main() {
expect(e, predicate((ArgumentError e) => e.message == 'Return me'));
}
env.closeAndDelete();
}, skip: notAtLeastDart2_15_0());
});
}

Future<String> _readStringAndRemove(Store store, int id) async {
Expand Down
11 changes: 0 additions & 11 deletions objectbox_test/test/test_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ Matcher sameAsList<T>(List<T> list) => unorderedEquals(list);
Future<void> yieldExecution() async =>
await Future<void>.delayed(Duration.zero);

dynamic notAtLeastDart2_15_0() {
final dartVersion = RegExp('([0-9]+).([0-9]+).([0-9]+)')
.firstMatch(Platform.version)
?.group(0);
if (dartVersion != null && dartVersion.compareTo('2.15.0') < 0) {
return 'Test requires Dart 2.15.0, skipping.';
} else {
return false;
}
}

bool atLeastDart(String expectedLowestVersion) {
final dartVersion = RegExp('([0-9]+).([0-9]+).([0-9]+)')
.firstMatch(Platform.version)
Expand Down

0 comments on commit 2b4d47e

Please sign in to comment.