Unverified Commit d242d136 authored by David Martos's avatar David Martos Committed by GitHub

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].*
parent 07ca92a6
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment