From 8ac3b5feae2d23d22811ce09bb83e8243c2ef487 Mon Sep 17 00:00:00 2001 From: Stargator Date: Fri, 6 Jul 2018 10:55:59 -0400 Subject: [PATCH 1/4] pubspec.yaml: Update unittest package a tiny bit --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 018237f..f28a8bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dependencies: enumerators: '>=0.6.0 <0.7.0' dev_dependencies: collection: '>=1.4.0 <1.15.0' - unittest: '>=0.9.0 <0.10.0' + unittest: '>=0.9.0 <0.12.0' From 03876a83526de972c46c3a2cdc45b7d612adbf6f Mon Sep 17 00:00:00 2001 From: Stargator Date: Fri, 6 Jul 2018 18:07:05 -0400 Subject: [PATCH 2/4] Migrate from unittest package to test package --- README.md | 2 +- example/demo.dart | 28 +++++++++++++++++++++++++--- example/mirrors_demo.dart | 2 +- pubspec.yaml | 2 +- test/mirrors_test.dart | 2 +- test/quickcheck_test.dart | 2 +- test/smallcheck_test.dart | 2 +- 7 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a965b00..96c7bce 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The only documentation so far is this README and the import 'dart:collection'; import 'package:propcheck/propcheck.dart'; import 'package:enumerators/combinators.dart' as c; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; // defines append and reverse part 'demolib.dart'; diff --git a/example/demo.dart b/example/demo.dart index 49cc91c..55caed9 100644 --- a/example/demo.dart +++ b/example/demo.dart @@ -8,7 +8,7 @@ library demo; import 'demolib.dart'; import 'package:propcheck/propcheck.dart'; import 'package:enumerators/combinators.dart' as c; -import 'package:unittest/unittest.dart' hide equals; +import 'package:test/test.dart' hide equals; /* --- the properties to test --- */ @@ -37,7 +37,18 @@ main() { group('smallcheck', () { final sc = new SmallCheck(depth: 10); test('good', () => sc.check(goodProperty)); - test('bad', () => sc.check(badProperty)); + + test('bad', () { + try { + sc.check(badProperty); + } catch (exception) { + expect(exception.toString(), equalsIgnoringWhitespace( + 'falsified after 11 tests\n' + ' argument 1: [true]\n' + ' argument 2: [false]\n' + '')); + } + }); }); // we test the properties against random pairs of lists of bools of @@ -45,6 +56,17 @@ main() { group('quickcheck', () { final qc = new QuickCheck(maxSize: 300, seed: 42); test('good', () => qc.check(goodProperty)); - test('bad', () => qc.check(badProperty)); + + test('bad', () { + try { + qc.check(badProperty); + } catch(exception) { + expect(exception.toString(), equalsIgnoringWhitespace( + 'falsified after 6 tests\n' + ' argument 1: [true, false, true]\n' + ' argument 2: [true, true]\n' + '')); + } + }); }); } diff --git a/example/mirrors_demo.dart b/example/mirrors_demo.dart index eeec688..e387ac3 100644 --- a/example/mirrors_demo.dart +++ b/example/mirrors_demo.dart @@ -2,7 +2,7 @@ library mirrors_demo; import 'demolib.dart'; import 'package:propcheck/propcheck_mirrors.dart'; -import 'package:unittest/unittest.dart' hide equals; +import 'package:test/test.dart' hide equals; /* --- the properties to test --- */ diff --git a/pubspec.yaml b/pubspec.yaml index f28a8bd..3aaea2c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dependencies: enumerators: '>=0.6.0 <0.7.0' dev_dependencies: collection: '>=1.4.0 <1.15.0' - unittest: '>=0.9.0 <0.12.0' + unittest: '>=0.9.0 <1.0.0' diff --git a/test/mirrors_test.dart b/test/mirrors_test.dart index 29455a0..f359b92 100644 --- a/test/mirrors_test.dart +++ b/test/mirrors_test.dart @@ -6,7 +6,7 @@ import 'package:propcheck/propcheck_mirrors.dart'; import 'package:enumerators/combinators.dart' as c; import 'package:enumerators/enumerators.dart' as e; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; bool boolArgument(bool x) => true; bool intArgument(int x) => true; diff --git a/test/quickcheck_test.dart b/test/quickcheck_test.dart index 34a2303..26d4a56 100644 --- a/test/quickcheck_test.dart +++ b/test/quickcheck_test.dart @@ -6,7 +6,7 @@ import 'package:propcheck/propcheck.dart'; import 'package:enumerators/combinators.dart' as c; import 'package:enumerators/enumerators.dart' as e; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; void quickCheckPerformsCheck() { bool called = false; diff --git a/test/smallcheck_test.dart b/test/smallcheck_test.dart index 38818ee..2152eee 100644 --- a/test/smallcheck_test.dart +++ b/test/smallcheck_test.dart @@ -5,7 +5,7 @@ import 'package:propcheck/propcheck.dart'; import 'package:enumerators/combinators.dart' as c; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; void smallCheckPerformsCheck() { bool called = false; From b400ef289ae0b88e393ffba727131b719ff1cf83 Mon Sep 17 00:00:00 2001 From: Stargator Date: Thu, 12 Jul 2018 16:59:17 -0400 Subject: [PATCH 3/4] propcheck: Remove try-catch --- example/demo.dart | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/example/demo.dart b/example/demo.dart index 55caed9..d2ae244 100644 --- a/example/demo.dart +++ b/example/demo.dart @@ -38,17 +38,7 @@ main() { final sc = new SmallCheck(depth: 10); test('good', () => sc.check(goodProperty)); - test('bad', () { - try { - sc.check(badProperty); - } catch (exception) { - expect(exception.toString(), equalsIgnoringWhitespace( - 'falsified after 11 tests\n' - ' argument 1: [true]\n' - ' argument 2: [false]\n' - '')); - } - }); + test('bad', () => sc.check(badProperty)); }); // we test the properties against random pairs of lists of bools of @@ -57,16 +47,6 @@ main() { final qc = new QuickCheck(maxSize: 300, seed: 42); test('good', () => qc.check(goodProperty)); - test('bad', () { - try { - qc.check(badProperty); - } catch(exception) { - expect(exception.toString(), equalsIgnoringWhitespace( - 'falsified after 6 tests\n' - ' argument 1: [true, false, true]\n' - ' argument 2: [true, true]\n' - '')); - } - }); + test('bad', () => qc.check(badProperty)); }); } From 5cc9054defd777c8c075f35e7787006cf35c8c1a Mon Sep 17 00:00:00 2001 From: Stargator Date: Thu, 12 Jul 2018 16:59:49 -0400 Subject: [PATCH 4/4] propcheck: Replace unittest with test package and adjust versioning --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3aaea2c..160c9c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dependencies: enumerators: '>=0.6.0 <0.7.0' dev_dependencies: collection: '>=1.4.0 <1.15.0' - unittest: '>=0.9.0 <1.0.0' + test: '>=0.12.0 <0.12.3+7'