mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix gen_defaults test randomness (#142743)
This PR improves the gen_defaults tests to not be tied to a particular order of execution. Since there is a global class that holds the state of the used/not used tokens, we need to clear this logger before each test. Fixes https://github.com/flutter/flutter/issues/142716 cc @zanderso @QuncCccccc *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
parent
07ca92a69e
commit
d242d1368f
@ -19,8 +19,16 @@ import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final TokenLogger logger = tokenLogger;
|
||||
// Required init with empty at least once to init late fields.
|
||||
// Then we can use the `clear` method.
|
||||
logger.init(allTokens: <String, dynamic>{}, versionMap: <String, List<String>>{});
|
||||
|
||||
setUp(() {
|
||||
// Cleanup the global token logger before each test, to not be tied to a particular
|
||||
// test order.
|
||||
logger.clear();
|
||||
});
|
||||
|
||||
test('Templates will append to the end of a file', () {
|
||||
final Directory tempDir = Directory.systemTemp.createTempSync('gen_defaults');
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user