dart-sdk/pkg/nnbd_migration/test/fix_reason_target_test.dart
Paul Berry 46b49d23ec Migration: track multiple fix reasons for expressions with complex types.
Change-Id: I1a1f78377ed64504e5315b5096914219dc625e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143188
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00

41 lines
1.5 KiB
Dart

// Copyright (c) 2020, 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 'package:nnbd_migration/fix_reason_target.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(FixReasonTargetTest);
});
}
@reflectiveTest
class FixReasonTargetTest {
void test_suffix_complex() {
var root = FixReasonTarget.root;
expect(root.returnType.typeArgument(0).suffix,
' for type argument 0 of return type');
expect(root.yieldedType.namedParameter('foo').suffix,
' for parameter foo of yielded type');
expect(root.namedParameter('foo').positionalParameter(0).suffix,
' for parameter 0 of parameter foo');
expect(root.positionalParameter(0).returnType.suffix,
' for return type of parameter 0');
expect(root.typeArgument(0).yieldedType.suffix,
' for yielded type from type argument 0');
}
void test_suffix_simple() {
var root = FixReasonTarget.root;
expect(root.suffix, '');
expect(root.returnType.suffix, ' for return type');
expect(root.yieldedType.suffix, ' for yielded type');
expect(root.namedParameter('foo').suffix, ' for parameter foo');
expect(root.positionalParameter(0).suffix, ' for parameter 0');
expect(root.typeArgument(0).suffix, ' for type argument 0');
}
}