Skip to content

Commit 03876a8

Browse files
committed
Migrate from unittest package to test package
1 parent 8ac3b5f commit 03876a8

7 files changed

Lines changed: 31 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The only documentation so far is this README and the
2020
import 'dart:collection';
2121
import 'package:propcheck/propcheck.dart';
2222
import 'package:enumerators/combinators.dart' as c;
23-
import 'package:unittest/unittest.dart';
23+
import 'package:test/test.dart';
2424
2525
// defines append and reverse
2626
part 'demolib.dart';

example/demo.dart

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library demo;
88
import 'demolib.dart';
99
import 'package:propcheck/propcheck.dart';
1010
import 'package:enumerators/combinators.dart' as c;
11-
import 'package:unittest/unittest.dart' hide equals;
11+
import 'package:test/test.dart' hide equals;
1212

1313
/* --- the properties to test --- */
1414

@@ -37,14 +37,36 @@ main() {
3737
group('smallcheck', () {
3838
final sc = new SmallCheck(depth: 10);
3939
test('good', () => sc.check(goodProperty));
40-
test('bad', () => sc.check(badProperty));
40+
41+
test('bad', () {
42+
try {
43+
sc.check(badProperty);
44+
} catch (exception) {
45+
expect(exception.toString(), equalsIgnoringWhitespace(
46+
'falsified after 11 tests\n'
47+
' argument 1: [true]\n'
48+
' argument 2: [false]\n'
49+
''));
50+
}
51+
});
4152
});
4253

4354
// we test the properties against random pairs of lists of bools of
4455
// combined size 0, 1, ..., 300.
4556
group('quickcheck', () {
4657
final qc = new QuickCheck(maxSize: 300, seed: 42);
4758
test('good', () => qc.check(goodProperty));
48-
test('bad', () => qc.check(badProperty));
59+
60+
test('bad', () {
61+
try {
62+
qc.check(badProperty);
63+
} catch(exception) {
64+
expect(exception.toString(), equalsIgnoringWhitespace(
65+
'falsified after 6 tests\n'
66+
' argument 1: [true, false, true]\n'
67+
' argument 2: [true, true]\n'
68+
''));
69+
}
70+
});
4971
});
5072
}

example/mirrors_demo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library mirrors_demo;
22

33
import 'demolib.dart';
44
import 'package:propcheck/propcheck_mirrors.dart';
5-
import 'package:unittest/unittest.dart' hide equals;
5+
import 'package:test/test.dart' hide equals;
66

77
/* --- the properties to test --- */
88

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ dependencies:
99
enumerators: '>=0.6.0 <0.7.0'
1010
dev_dependencies:
1111
collection: '>=1.4.0 <1.15.0'
12-
unittest: '>=0.9.0 <0.12.0'
12+
unittest: '>=0.9.0 <1.0.0'

test/mirrors_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import 'package:propcheck/propcheck_mirrors.dart';
77
import 'package:enumerators/combinators.dart' as c;
88
import 'package:enumerators/enumerators.dart' as e;
9-
import 'package:unittest/unittest.dart';
9+
import 'package:test/test.dart';
1010

1111
bool boolArgument(bool x) => true;
1212
bool intArgument(int x) => true;

test/quickcheck_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import 'package:propcheck/propcheck.dart';
77
import 'package:enumerators/combinators.dart' as c;
88
import 'package:enumerators/enumerators.dart' as e;
9-
import 'package:unittest/unittest.dart';
9+
import 'package:test/test.dart';
1010

1111
void quickCheckPerformsCheck() {
1212
bool called = false;

test/smallcheck_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import 'package:propcheck/propcheck.dart';
77
import 'package:enumerators/combinators.dart' as c;
8-
import 'package:unittest/unittest.dart';
8+
import 'package:test/test.dart';
99

1010
void smallCheckPerformsCheck() {
1111
bool called = false;

0 commit comments

Comments
 (0)