flutter/packages/flutter_tools/test/project_file_invalidator_test.dart
Alexander Aprelev 12c4e050be
Use source list from the compiler to track invalidated files for hot reload. (#29693)
* Use source list from the compiler to track invalidated files.

* Revert accidental change

* Fix first-time-seen-the-file logic

* Fix/simplify invalidate logic now that we can rely on compiler to let us know what is the cut-off point for invalidation.

* Update devfs mock to accommodate for new fields

* Fix deleted files case

* Analyzer found missing final
2019-03-20 21:58:15 -07:00

34 lines
1.1 KiB
Dart

// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/run_hot.dart';
import 'src/common.dart';
import 'src/context.dart';
void main() {
group('ProjectFileInvalidator', () {
final MemoryFileSystem memoryFileSystem = MemoryFileSystem();
testUsingContext('Empty project', () async {
expect(
ProjectFileInvalidator.findInvalidated(lastCompiled: DateTime.now(), urisToMonitor: <Uri>[]),
isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem,
});
testUsingContext('Non-existent files are ignored', () async {
expect(
ProjectFileInvalidator.findInvalidated(
lastCompiled: DateTime.now(),
urisToMonitor: <Uri>[Uri.parse('/not-there-anymore')]),
isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => memoryFileSystem,
});
});
}