Skip to content

Commit

Permalink
Update goldens (#3315)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrousselGit authored Feb 3, 2024
1 parent 98f3bd1 commit 8544e84
Show file tree
Hide file tree
Showing 44 changed files with 1,813 additions and 2,590 deletions.
2 changes: 1 addition & 1 deletion packages/riverpod_lint_flutter_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
dev_dependencies:
build_runner: ^2.4.6
custom_lint: ^0.5.2
custom_lint_core: ^0.5.10
custom_lint_core: ^0.5.14
freezed: ^2.3.2
json_serializable: ^6.6.1
riverpod_lint:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Message: `Convert to functional provider`
=== diff (starting at line 7)
/// Some comment
@riverpod
- class Example extends _$Example {
- @override
- int build() => 0;
- }
+ int example(ExampleRef ref) => 0;

/// Some comment
===
Message: `Convert to functional provider`
=== diff (starting at line 7)
/// Some comment
@riverpod
- class Example extends _$Example {
- @override
- int build() => 0;
- }
+ int example(ExampleRef ref) => 0;

/// Some comment
===
Message: `Convert to functional provider`
=== diff (starting at line 7)
/// Some comment
@riverpod
- class Example extends _$Example {
- @override
- int build() => 0;
- }
+ int example(ExampleRef ref) => 0;

/// Some comment
===
Message: `Convert to functional provider`
=== diff (starting at line 14)
/// Some comment
@riverpod
- class ExampleFamily extends _$ExampleFamily {
- @override
- int build({required int a, String b = '42'}) {
- // Hello world
- return 0;
- }
+ int exampleFamily(ExampleFamilyRef ref, {required int a, String b = '42'}) {
+ // Hello world
+ return 0;
+ }
===

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
import 'dart:io';

import 'package:riverpod_lint/src/assists/class_based_to_functional_provider.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

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

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

final result = await resolveFile2(path: file.path);
result as ResolvedUnitResult;
(result) async {
final assist = ClassBasedToFunctionalProvider();

return [
...await assist.testRun(result, const SourceRange(145, 0)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Message: `Convert to class-based provider`
=== diff (starting at line 7)
/// Some comment
@riverpod
- int example(ExampleRef ref) => 0;
+ class Example extends _$Example {
+ @override
+ int build() => 0;
+ }

/// Some comment
===
Message: `Convert to class-based provider`
=== diff (starting at line 11)
/// Some comment
@riverpod
- int exampleFamily(ExampleFamilyRef ref, {required int a, String b = '42'}) {
- // Hello world
- return 0;
+ class ExampleFamily extends _$ExampleFamily {
+ @override
+ int build({required int a, String b = '42'}) {
+ // Hello world
+ return 0;
+ }
}
===

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
import 'dart:io';

import 'package:riverpod_lint/src/assists/functional_to_class_based_provider.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/analysis/utilities.dart';

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

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

final result = await resolveFile2(path: file.path);
result as ResolvedUnitResult;
(result) async {
final assist = FunctionalToClassBasedProvider();

return [
...await assist.testRun(result, const SourceRange(145, 0)),
Expand Down
Loading

0 comments on commit 8544e84

Please sign in to comment.