Skip to content

Commit

Permalink
Merge pull request #71 from mateuszwojtczak/use-dart-3
Browse files Browse the repository at this point in the history
Dart 3 support
  • Loading branch information
evanweible-wf authored Oct 31, 2023
2 parents 0baa399 + 00d4bfe commit cc6dee2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 139 deletions.
2 changes: 1 addition & 1 deletion example/regex_substituter_fixtures/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ version: 0.0.0
dependencies:
codemod: ^0.1.0
environment:
sdk: '>=2.11.0 <3.0.0'
sdk: '>=3.0.0 <4.0.0'
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: codemod
version: 1.0.11
version: 1.1.0
homepage: https://github.com/Workiva/dart_codemod

description: >
Write and run automated code modifications on a codebase. Primarily geared
towards updating and refactoring Dart code, but can modify any files.
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=3.0.0 <4.0.0'

dependencies:
analyzer: ^5.0.0
analyzer: ^6.3.0
args: ^2.0.0
glob: ^2.0.1
io: ^1.0.0
Expand All @@ -27,5 +27,5 @@ dev_dependencies:
dart_style: ^2.0.0
dependency_validator: ^3.0.0
meta: ^1.6.0
mockito: ^5.3.2
mocktail: ^1.0.1
pedantic: ^1.11.0
5 changes: 2 additions & 3 deletions test/aggregate_suggestor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
@TestOn('vm')
import 'package:codemod/codemod.dart';
import 'package:codemod/test.dart';
import 'package:mockito/annotations.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';

import 'aggregate_suggestor_test.mocks.dart';
class MockPatch extends Mock implements Patch {}

@override
Stream<Patch> fooSuggestor(_) async* {
Expand All @@ -36,7 +36,6 @@ class BarPatch extends MockPatch {}

class ShouldBeSkippedPatch extends MockPatch {}

@GenerateMocks([Patch])
void main() {
test('aggregate should yield patches from each suggestor', () async {
final suggestor = aggregate([fooSuggestor, barSuggestor]);
Expand Down
38 changes: 0 additions & 38 deletions test/aggregate_suggestor_test.mocks.dart

This file was deleted.

16 changes: 7 additions & 9 deletions test/util_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
@TestOn('vm')
import 'dart:io';

import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:mocktail/mocktail.dart';
import 'package:source_span/source_span.dart';
import 'package:test/test.dart';

import 'package:codemod/src/patch.dart';
import 'package:codemod/src/util.dart';

import 'util_test.mocks.dart';
class MockStdout extends Mock implements Stdout {}

@GenerateMocks([Stdout])
void main() {
group('Utils', () {
group('applyPatches()', () {
Expand Down Expand Up @@ -132,21 +130,21 @@ line 5;''');
group('calculateDiffSize()', () {
test('returns 10 if stdout does not have a terminal', () {
final mockStdout = MockStdout();
when(mockStdout.hasTerminal).thenReturn(false);
when(() => mockStdout.hasTerminal).thenReturn(false);
expect(calculateDiffSize(mockStdout), 10);
});

test('returns 10 if # of terminal lines is too small', () {
final mockStdout = MockStdout();
when(mockStdout.hasTerminal).thenReturn(true);
when(mockStdout.terminalLines).thenReturn(15);
when(() => mockStdout.hasTerminal).thenReturn(true);
when(() => mockStdout.terminalLines).thenReturn(15);
expect(calculateDiffSize(mockStdout), 10);
});

test('returns 10 less than available # of terminal lines', () {
final mockStdout = MockStdout();
when(mockStdout.hasTerminal).thenReturn(true);
when(mockStdout.terminalLines).thenReturn(50);
when(() => mockStdout.hasTerminal).thenReturn(true);
when(() => mockStdout.terminalLines).thenReturn(50);
expect(calculateDiffSize(mockStdout), 40);
});
});
Expand Down
84 changes: 0 additions & 84 deletions test/util_test.mocks.dart

This file was deleted.

0 comments on commit cc6dee2

Please sign in to comment.