Skip to content

Commit

Permalink
Reorder lint tests (#2932)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit authored Sep 28, 2023
1 parent 4519e9a commit dfe84e0
Show file tree
Hide file tree
Showing 49 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions packages/riverpod_lint_flutter_test/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ targets:
generate_for:
exclude:
# Those files voluntarily have the generation fail
- test/goldens/fixes/notifier_build.dart
- test/goldens/lints/notifier_build.dart
- test/lints/notifier_build/notifier_build.dart
- test/lints/notifier_build/fix/notifier_build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

import '../golden.dart';
import '../../golden.dart';

void main() {
testGolden(
'Convert plain class provider to functional provider',
'assists/convert_class_based_provider_to_functional.json',
'assists/convert_class_based_provider_to_functional/convert_class_based_provider_to_functional.json',
() async {
final assist = ClassBasedToFunctionalProvider();
final file = File(
'test/assists/convert_class_based_provider_to_functional.dart',
'test/assists/convert_class_based_provider_to_functional/convert_class_based_provider_to_functional.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

import '../golden.dart';
import '../../golden.dart';

void main() {
testGolden(
'Convert functional providers to class-based providers',
'assists/convert_functional_provider_to_class_based.json',
'assists/convert_functional_provider_to_class_based/convert_functional_provider_to_class_based.json',
() async {
final assist = FunctionalToClassBasedProvider();
final file = File(
'test/assists/convert_functional_provider_to_class_based.dart',
'test/assists/convert_functional_provider_to_class_based/convert_functional_provider_to_class_based.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:riverpod_lint/src/assists/convert_to_widget_utils.dart';
import 'package:riverpod_lint/src/riverpod_custom_lint.dart';
import 'package:test/test.dart';

import '../golden.dart';
import '../../golden.dart';

void main() {
final pubspecWithDependencies = Pubspec(
Expand All @@ -28,7 +28,7 @@ void main() {
targetWidget: targetWidget,
),
'Convert widgets to ${targetWidget.name}s with hooks_riverpod and flutter_hooks dependency',
'assists/convert_to_${targetWidget.name.toSnakeCase()}.json',
'assists/convert_to_widget/convert_to_${targetWidget.name.toSnakeCase()}.json',
pubspecWithDependencies,
targetWidget == StatelessBaseWidgetType.statelessWidget ? 6 : 9,
);
Expand All @@ -42,7 +42,7 @@ void main() {
targetWidget: targetWidget,
),
'Convert widgets to ${targetWidget.name}s with hooks_riverpod and flutter_hooks dependency',
'assists/convert_to_${targetWidget.name.toSnakeCase()}.json',
'assists/convert_to_widget/convert_to_${targetWidget.name.toSnakeCase()}.json',
pubspecWithDependencies,
targetWidget == StatefulBaseWidgetType.statefulWidget ? 6 : 9,
);
Expand Down Expand Up @@ -77,7 +77,7 @@ void main() {
case StatelessBaseWidgetType.consumerWidget:
case StatelessBaseWidgetType.statelessWidget:
goldenFilePath =
'assists/convert_to_${targetWidget.name.toSnakeCase()}.json';
'assists/convert_to_widget/convert_to_${targetWidget.name.toSnakeCase()}.json';
break;
}

Expand Down Expand Up @@ -117,7 +117,7 @@ void main() {
case StatefulBaseWidgetType.consumerStatefulWidget:
case StatefulBaseWidgetType.statefulWidget:
goldenFilePath =
'assists/convert_to_${targetWidget.name.toSnakeCase()}.json';
'assists/convert_to_widget/convert_to_${targetWidget.name.toSnakeCase()}.json';
break;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ void _runGoldenTest(
goldenFilePath,
() async {
final file = File(
'test/assists/convert_to_widget.dart',
'test/assists/convert_to_widget/convert_to_widget.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

import '../golden.dart';
import '../../golden.dart';

void main() {
testGolden(
'Wrap with consumer',
'assists/wrap_with_consumer.json',
'assists/wrap_widget/wrap_with_consumer.json',
() async {
final assist = WrapWithConsumer();
final file = File('test/assists/wrap_widget.dart').absolute;
final file = File('test/assists/wrap_widget/wrap_widget.dart').absolute;

final result = await resolveFile2(path: file.path);
result as ResolvedUnitResult;
Expand All @@ -42,10 +42,10 @@ void main() {

testGolden(
'Wrap with ProviderScope',
'assists/wrap_with_provider_scope.json',
'assists/wrap_widget/wrap_with_provider_scope.json',
() async {
final assist = WrapWithProviderScope();
final file = File('test/assists/wrap_widget.dart').absolute;
final file = File('test/assists/wrap_widget/wrap_widget.dart').absolute;

final result = await resolveFile2(path: file.path);
result as ResolvedUnitResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import 'package:riverpod_lint/src/lints/notifier_build.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

import '../../golden.dart';
import '../../../golden.dart';

void main() {
testGolden(
'Verify that @riverpod classes has the build method',
'goldens/fixes/notifier_build.json',
'lints/notifier_build/fix/notifier_build.json',
() async {
const lint = NotifierBuild();
final fix = lint.getFixes().single;
final file = File(
'test/goldens/fixes/notifier_build.dart',
'test/lints/notifier_build/fix/notifier_build.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:test/test.dart';

import '../golden.dart';
import '../../golden.dart';

void main() {
testGolden(
'Verify that @riverpod classes extend the generated typedef',
'goldens/notifier_extends.json',
'lints/notifier_extends/notifier_extends.json',
() async {
final lint = NotifierExtends();
final fix = lint.getFixes().single as DartFix;
final file = File(
'test/goldens/notifier_extends.dart',
'test/lints/notifier_extends/notifier_extends.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import '../../golden.dart';
void main() {
testGolden(
'Verify that @riverpod classes extend the generated typedef',
'goldens/fixes/provider_dependencies.json',
'lints/provider_dependencies/provider_dependencies.json',
() async {
const lint = ProviderDependencies();
final fix = lint.getFixes().single;
final file = File(
'test/goldens/fixes/provider_dependencies.dart',
'test/lints/provider_dependencies/provider_dependencies.dart',
).absolute;

final result = await resolveFile2(path: file.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ class _$FreezedExampleCopyWithImpl<$Res, $Val extends FreezedExample>
}

/// @nodoc
abstract class _$$_FreezedExampleCopyWith<$Res> {
factory _$$_FreezedExampleCopyWith(
_$_FreezedExample value, $Res Function(_$_FreezedExample) then) =
__$$_FreezedExampleCopyWithImpl<$Res>;
abstract class _$$FreezedExampleImplCopyWith<$Res> {
factory _$$FreezedExampleImplCopyWith(_$FreezedExampleImpl value,
$Res Function(_$FreezedExampleImpl) then) =
__$$FreezedExampleImplCopyWithImpl<$Res>;
}

/// @nodoc
class __$$_FreezedExampleCopyWithImpl<$Res>
extends _$FreezedExampleCopyWithImpl<$Res, _$_FreezedExample>
implements _$$_FreezedExampleCopyWith<$Res> {
__$$_FreezedExampleCopyWithImpl(
_$_FreezedExample _value, $Res Function(_$_FreezedExample) _then)
class __$$FreezedExampleImplCopyWithImpl<$Res>
extends _$FreezedExampleCopyWithImpl<$Res, _$FreezedExampleImpl>
implements _$$FreezedExampleImplCopyWith<$Res> {
__$$FreezedExampleImplCopyWithImpl(
_$FreezedExampleImpl _value, $Res Function(_$FreezedExampleImpl) _then)
: super(_value, _then);
}

/// @nodoc
class _$_FreezedExample implements _FreezedExample {
_$_FreezedExample();
class _$FreezedExampleImpl implements _FreezedExample {
_$FreezedExampleImpl();

@override
String toString() {
Expand All @@ -64,13 +64,13 @@ class _$_FreezedExample implements _FreezedExample {
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$_FreezedExample);
(other.runtimeType == runtimeType && other is _$FreezedExampleImpl);
}

@override
int get hashCode => runtimeType.hashCode;
}

abstract class _FreezedExample implements FreezedExample {
factory _FreezedExample() = _$_FreezedExample;
factory _FreezedExample() = _$FreezedExampleImpl;
}

0 comments on commit dfe84e0

Please sign in to comment.