Remove tests
These tests were so old that the libraries that they depend on were removed, and 3.x.x isn't getting updated any time soon.
This commit is contained in:
parent
47c37c5e74
commit
97af6caaa5
@ -1,33 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:build/build.dart';
|
|
||||||
import 'package:build_test/build_test.dart';
|
|
||||||
import 'package:isar_generator/isar_generator.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('Error case', () {
|
|
||||||
for (final file in Directory('test/errors').listSync(recursive: true)) {
|
|
||||||
if (file is! File || !file.path.endsWith('.dart')) continue;
|
|
||||||
|
|
||||||
test(file.path, () async {
|
|
||||||
final content = await file.readAsLines();
|
|
||||||
|
|
||||||
final errorMessage = content.first.split('//').last.trim();
|
|
||||||
|
|
||||||
var error = '';
|
|
||||||
try {
|
|
||||||
await testBuilder(
|
|
||||||
getIsarGenerator(BuilderOptions.empty),
|
|
||||||
{'a|${file.path}': content.join('\n')},
|
|
||||||
reader: await PackageAssetReader.currentIsolate(),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
error = e.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(error.toLowerCase(), contains(errorMessage.toLowerCase()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
// must not be abstract
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
abstract class Model {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
// supertype annotated with @collection
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Supertype {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Subtype implements Supertype {
|
|
||||||
@override
|
|
||||||
Id? id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model implements Subtype {
|
|
||||||
@override
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// unnamed constructor
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Model.create();
|
|
||||||
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// constructor parameter does not match a property
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
// ignore: avoid_unused_constructor_parameters
|
|
||||||
Model(this.prop1, String somethingElse);
|
|
||||||
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
final String prop1;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// constructor parameter type does not match property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
// ignore: avoid_unused_constructor_parameters
|
|
||||||
Model(int prop1);
|
|
||||||
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
String prop1 = '5';
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
// only classes
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
// ignore: invalid_annotation_target
|
|
||||||
@collection
|
|
||||||
enum Test { a, b, c }
|
|
@ -1,8 +0,0 @@
|
|||||||
// must not be abstract
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
abstract class Model {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
// only classes
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
// ignore: invalid_annotation_target
|
|
||||||
@collection
|
|
||||||
mixin Test {}
|
|
@ -1,9 +0,0 @@
|
|||||||
// must be public
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
// ignore: unused_element
|
|
||||||
class _Model {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
// only classes
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
// ignore: invalid_annotation_target
|
|
||||||
@collection
|
|
||||||
const t = 'hello';
|
|
@ -1,10 +0,0 @@
|
|||||||
// two or more properties with type "Id" defined
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Test {
|
|
||||||
Id? id1;
|
|
||||||
|
|
||||||
Id? id2;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// no id property defined
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Test {
|
|
||||||
late int id;
|
|
||||||
|
|
||||||
late String name;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// only the last property of a composite index may be a double value
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('val2')])
|
|
||||||
double? val1;
|
|
||||||
|
|
||||||
String? val2;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// composite indexes do not support non-hashed lists
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('str')], type: IndexType.value)
|
|
||||||
List<int>? list;
|
|
||||||
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// last property of a composite index may be a non-hashed string
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('str2')], type: IndexType.value)
|
|
||||||
String? str1;
|
|
||||||
|
|
||||||
String? str2;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// ids cannot be indexed
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('id')])
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// list<double> may must not be hashed
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(type: IndexType.hash)
|
|
||||||
List<double>? list;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// same name
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(name: 'myindex')
|
|
||||||
String? prop1;
|
|
||||||
|
|
||||||
@Index(name: 'myindex')
|
|
||||||
String? prop2;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// composite index contains duplicate properties
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('str1')], type: IndexType.value)
|
|
||||||
String? str1;
|
|
||||||
|
|
||||||
String? str2;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// names must not be blank or start with "_"
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(name: '_index')
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// only strings and lists may be hashed
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(type: IndexType.hash)
|
|
||||||
int? val;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// only string lists may have hashed elements
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(type: IndexType.hashElements)
|
|
||||||
List<int>? list;
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
// only unique indexes can replace
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(replace: true)
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// objects may not be indexed
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
EmbeddedModel? obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@embedded
|
|
||||||
class EmbeddedModel {}
|
|
@ -1,14 +0,0 @@
|
|||||||
// objects may not be indexed
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(type: IndexType.hash)
|
|
||||||
List<EmbeddedModel>? list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@embedded
|
|
||||||
class EmbeddedModel {}
|
|
@ -1,11 +0,0 @@
|
|||||||
// property does not exist
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Index(composite: [CompositeIndex('myProp')])
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// target of backlink does not exist
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model1 {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Backlink(to: 'abc')
|
|
||||||
final IsarLink<Model2> link = IsarLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
// target of backlink is also a backlink
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model1 {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Backlink(to: 'link')
|
|
||||||
final IsarLink<Model2> link = IsarLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Backlink(to: 'link')
|
|
||||||
final IsarLink<Model1> link = IsarLink();
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// target of backlink is not a link
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model1 {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Backlink(to: 'str')
|
|
||||||
final IsarLink<Model2> link = IsarLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
String? str;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// same name
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
final IsarLink<Model2> prop1 = IsarLink();
|
|
||||||
|
|
||||||
@Name('prop1')
|
|
||||||
final IsarLinks<Model2> prop2 = IsarLinks();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// names must not be blank or start with
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Name('_link')
|
|
||||||
final IsarLink<Model2> link = IsarLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// must not be late
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
late IsarLink<Model2> link;
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// must not be nullable
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
IsarLink<Model2>? link;
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// link target is not annotated with @collection
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
final IsarLink<int> link = IsarLink();
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// links type must not be nullable
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
final IsarLink<Model2?> link = IsarLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model2 {
|
|
||||||
Id? id;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// same name
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
String? prop1;
|
|
||||||
|
|
||||||
@Name('prop1')
|
|
||||||
String? prop2;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// unsupported enum property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum field;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final bool value = true;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// unsupported enum property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum field;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final double value = 5.5;
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// has duplicate values
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum field;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
option1(1),
|
|
||||||
option2(2),
|
|
||||||
option3(1);
|
|
||||||
|
|
||||||
const MyEnum(this.value);
|
|
||||||
|
|
||||||
final int value;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// unsupported enum property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum field;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final float value = 5.5;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// unsupported enum property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final List<String> value = [];
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
// enum property must be annotated with @enumerated
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
late MyEnum? prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
a;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// null values are not supported
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final String? value = null;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// unsupported enum property type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.value, 'value')
|
|
||||||
late MyEnum prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MyEnum {
|
|
||||||
optionA;
|
|
||||||
|
|
||||||
final value = EmbeddedModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@embedded
|
|
||||||
class EmbeddedModel {}
|
|
@ -1,11 +0,0 @@
|
|||||||
// names must not be blank or start with "_"
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
@Name('_prop')
|
|
||||||
String? prop;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// bytes must not be nullable
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
late byte? prop;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// bytes must not be nullable
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
late List<byte?> prop;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// unsupported type
|
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
|
||||||
|
|
||||||
@collection
|
|
||||||
class Model {
|
|
||||||
Id? id;
|
|
||||||
|
|
||||||
late Set<String>? prop;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user