Files
sdk/pkg/linter/test/integration_test.dart
T
Sam Rawlins a67b4d4400 linter: Convert IOSinks to StringSink; use StringBuffer where possible
I think IOSink was used previously in these places because `Stdout`
implements IOSink. But IOSink also implements StringSink and only adds
some `add*` methods, and `close`, `flush`, `done`, and `encoding`,
which we don't use. Really, we are looking for a StringSink here.

Converting things to a StringSink means we can ditch CollectingSink,
and the `buffer` field on CollectingSink, in favor of a simple
StringBuffer, which also implements StringSink.

Change-Id: Id4a251424742493e37e9630f82c3e6c4a2b1d8bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390665
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-17 19:53:58 +00:00

41 lines
983 B
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:analyzer/src/lint/io.dart';
import 'package:test/test.dart';
import '../tool/checks/check_all_yaml.dart';
import '../tool/checks/check_messages_yaml.dart';
void main() {
group('integration', () {
group('config', () {
var currentOut = outSink;
var collectingOut = StringBuffer();
setUp(() {
exitCode = 0;
outSink = collectingOut;
});
tearDown(() {
collectingOut.clear();
outSink = currentOut;
exitCode = 0;
});
});
group('examples', () {
test('all.yaml', () {
var errors = checkAllYaml();
if (errors != null) {
fail(errors);
}
});
});
test('messages.yaml', checkMessagesYaml);
});
}