This reverts commit 53e6876226.
This commit is contained in:
@@ -418,8 +418,8 @@ Future<void> verifyNoSyncAsyncStar(String workingDirectory, {int minimumMatches
|
||||
}
|
||||
}
|
||||
|
||||
final RegExp _findGoldenTestPattern = RegExp(r'(matchesGoldenFile|expectFlakyGolden)\(');
|
||||
final RegExp _findGoldenDefinitionPattern = RegExp(r'(matchesGoldenFile|expectFlakyGolden)\(Object');
|
||||
final RegExp _findGoldenTestPattern = RegExp(r'matchesGoldenFile\(');
|
||||
final RegExp _findGoldenDefinitionPattern = RegExp(r'matchesGoldenFile\(Object');
|
||||
final RegExp _leadingComment = RegExp(r'//');
|
||||
final RegExp _goldenTagPattern1 = RegExp(r'@Tags\(');
|
||||
final RegExp _goldenTagPattern2 = RegExp(r"'reduced-test-set'");
|
||||
@@ -431,17 +431,8 @@ const String _ignoreGoldenTag = '// flutter_ignore: golden_tag (see analyze.dart
|
||||
const String _ignoreGoldenTagForFile = '// flutter_ignore_for_file: golden_tag (see analyze.dart)';
|
||||
|
||||
Future<void> verifyGoldenTags(String workingDirectory, { int minimumMatches = 2000 }) async {
|
||||
// Skip flutter_goldens/lib because this library uses `matchesGoldenFile`
|
||||
// but is not itself a test that needs tags.
|
||||
final String flutterGoldensPackageLib = path.join(flutterPackages, 'flutter_goldens', 'lib');
|
||||
bool isWithinFlutterGoldenLib(File file) {
|
||||
return path.isWithin(flutterGoldensPackageLib, file.path);
|
||||
}
|
||||
|
||||
final List<String> errors = <String>[];
|
||||
final Stream<File> allTestFiles = _allFiles(workingDirectory, 'dart', minimumMatches: minimumMatches)
|
||||
.where((File file) => !isWithinFlutterGoldenLib(file));
|
||||
await for (final File file in allTestFiles) {
|
||||
await for (final File file in _allFiles(workingDirectory, 'dart', minimumMatches: minimumMatches)) {
|
||||
bool needsTag = false;
|
||||
bool hasTagNotation = false;
|
||||
bool hasReducedTag = false;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This would fail analysis, but it is ignored
|
||||
// flutter_ignore_for_file: golden_tag (see analyze.dart)
|
||||
|
||||
@Tags(<String>['some-other-tag'])
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'golden_class.dart';
|
||||
|
||||
void main() {
|
||||
expectFlakyGolden('key', 'String');
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The reduced test set tag is missing. This should fail analysis.
|
||||
@Tags(<String>['some-other-tag'])
|
||||
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'golden_class.dart';
|
||||
|
||||
void main() {
|
||||
expectFlakyGolden('finder', 'missing_tag.png');
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The tag is missing. This should fail analysis.
|
||||
|
||||
import 'golden_class.dart';
|
||||
|
||||
void main() {
|
||||
expectFlakyGolden('key', 'missing_tag.png');
|
||||
}
|
||||
@@ -7,7 +7,3 @@
|
||||
void matchesGoldenFile(Object key) {
|
||||
return;
|
||||
}
|
||||
|
||||
void expectFlakyGolden(Object key, String string){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,8 @@
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// expectFlakyGolden(a, b)
|
||||
|
||||
// Other comments
|
||||
// matchesGoldenFile('comment.png');
|
||||
// expectFlakyGolden(a, b);
|
||||
|
||||
String literal = 'matchesGoldenFile()'; // flutter_ignore: golden_tag (see analyze.dart)
|
||||
String flakyLiteral = 'expectFlakyGolden';
|
||||
|
||||
@@ -79,9 +79,7 @@ void main() {
|
||||
'at the top of the file before import statements.';
|
||||
const String missingTag = "Files containing golden tests must be tagged with 'reduced-test-set'.";
|
||||
final List<String> lines = <String>[
|
||||
'║ test/analyze-test-input/root/packages/foo/flaky_golden_no_tag.dart: $noTag',
|
||||
'║ test/analyze-test-input/root/packages/foo/golden_missing_tag.dart: $missingTag',
|
||||
'║ test/analyze-test-input/root/packages/foo/flaky_golden_missing_tag.dart: $missingTag',
|
||||
'║ test/analyze-test-input/root/packages/foo/golden_no_tag.dart: $noTag',
|
||||
]
|
||||
.map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/'))
|
||||
|
||||
Reference in New Issue
Block a user