-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test refactoring by folders. Running tests for all existing inputs.
- Loading branch information
1 parent
827b437
commit 20dd56d
Showing
63 changed files
with
120 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:realm_generator/realm_generator.dart'; | ||
import 'package:test/test.dart'; | ||
import 'test_util.dart'; | ||
|
||
void main() { | ||
const directory = 'test/error_test_data'; | ||
getListOfTestFiles(directory).forEach((inputFile, outputFile) { | ||
executeTest(getTestName(inputFile), () async { | ||
await expectLater( | ||
() async => await generatorTestBuilder(directory, inputFile), | ||
throwsA( | ||
isA<RealmInvalidGenerationSourceError>().having( | ||
(e) => e.format(), | ||
'format()', | ||
await readFileAsErrorFormattedString(directory, outputFile), | ||
), | ||
), | ||
); | ||
}); | ||
}); | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../bool_not_allowed_as_primary_key.expected → .../bool_not_allowed_as_primary_key.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ool_not_allowed_on_indexed_field.expected → ...ool_not_allowed_on_indexed_field.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
..._io/defining_both_class_prefixes.expected → ...ata/defining_both_class_prefixes.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rator_test_io/double_primary_key.expected → ...ror_test_data/double_primary_key.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ator_test_io/illigal_constructor.expected → ...or_test_data/illigal_constructor.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...generator_test_io/invalid_extend.expected → ...t/error_test_data/invalid_extend.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st_io/invalid_model_name_mapping.expected → ..._data/invalid_model_name_mapping.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...est_io/invalid_model_name_prefix.expected → ...t_data/invalid_model_name_prefix.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st_io/list_of_list_not_supported.expected → ..._data/list_of_list_not_supported.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...enerator_test_io/map_unsupported.expected → .../error_test_data/map_unsupported.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rator_test_io/missing_underscore.expected → ...ror_test_data/missing_underscore.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
..._nullable_realm_object_reference.expected → ..._nullable_realm_object_reference.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...nerator_test_io/not_a_realm_type.expected → ...error_test_data/not_a_realm_type.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...or_test_io/not_an_indexable_type.expected → ..._test_data/not_an_indexable_type.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../generator_test_io/nullable_list.expected → ...st/error_test_data/nullable_list.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...r_test_io/nullable_list_elements.expected → ...test_data/nullable_list_elements.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...o/primary_key_cannot_be_nullable.expected → ...a/primary_key_cannot_be_nullable.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st_io/repeated_class_annotations.expected → ..._data/repeated_class_annotations.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st_io/repeated_field_annotations.expected → ..._data/repeated_field_annotations.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ator_test_io/reusing_map_to_name.expected → ...or_test_data/reusing_map_to_name.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...enerator_test_io/set_unsupported.expected → .../error_test_data/set_unsupported.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
|
||
import 'test_util.dart'; | ||
|
||
void main() { | ||
final tests = { | ||
'required argument with default value', | ||
'required argument', | ||
'list initialization', | ||
'optional argument', | ||
'user defined getter', | ||
}; | ||
|
||
for (var testData in tests) { | ||
var fileName = testData.replaceAll(' ', '_'); | ||
|
||
generatorTest(testData, () async { | ||
await generatorTestBuilder('good_test_io', '$fileName.dart', '$fileName.expected'); | ||
const directory = 'test/good_test_data'; | ||
getListOfTestFiles(directory).forEach((inputFile, outputFile) { | ||
executeTest(getTestName(inputFile), () async { | ||
await generatorTestBuilder(directory, inputFile, outputFile); | ||
}); | ||
} | ||
}); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:build_test/build_test.dart'; | ||
import 'package:realm_generator/realm_generator.dart'; | ||
import 'package:test/test.dart'; | ||
import 'test_util.dart'; | ||
|
||
void main() { | ||
const directory = 'test/info_test_data'; | ||
getListOfTestFiles(directory).forEach((inputFile, outputFile) { | ||
executeTest(getTestName(inputFile), () async { | ||
final sb = StringBuffer(); | ||
var done = false; | ||
|
||
await testBuilder( | ||
generateRealmObjects(), | ||
await getInputFileAsset('$directory/$inputFile'), | ||
reader: await PackageAssetReader.currentIsolate(), | ||
onLog: (l) { | ||
if (!done) { | ||
// disregard all, but first record | ||
sb.writeln(l); | ||
done = true; | ||
} | ||
}, | ||
); | ||
|
||
expect( | ||
sb.toString(), | ||
await readFileAsErrorFormattedString(directory, outputFile), | ||
); | ||
}); | ||
}); | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...st_io/primary_key_always_indexed.expected → ..._data/primary_key_always_indexed.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.