Skip to content

Commit 5e6d20f

Browse files
authored
Fix testing (#79)
* Avoid `package:test` in `lib/src/`. Bumped SDK constraint to `^3.0.0` to enable us to use new language features. Tweaked code as to not require `package:test` in `lib/src/`, since this made publishing impossible. * Upgrade ffigen * Update changelog to reflect bumped SDK constraint
1 parent 7bf1ca5 commit 5e6d20f

21 files changed

+362
-306
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Added Windows desktop support.
44
* Additional API documentation.
55
* Add `topics` to `pubspec.yaml`.
6+
* Bumped lower bound SDK constraint to require Dart `>= 3.0.0`.
67

78
# 0.5.3
89
* Migrate to Flutter 3.0

example/pubspec.lock

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8"
8+
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "47.0.0"
11+
version: "61.0.0"
1212
analyzer:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80"
16+
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "4.7.0"
19+
version: "5.13.0"
2020
args:
2121
dependency: transitive
2222
description:
2323
name: args
24-
sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515
24+
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
2525
url: "https://pub.dev"
2626
source: hosted
27-
version: "2.3.1"
27+
version: "2.4.2"
2828
async:
2929
dependency: transitive
3030
description:
@@ -85,18 +85,18 @@ packages:
8585
dependency: transitive
8686
description:
8787
name: crypto
88-
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
88+
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
8989
url: "https://pub.dev"
9090
source: hosted
91-
version: "3.0.2"
91+
version: "3.0.3"
9292
cupertino_icons:
9393
dependency: "direct main"
9494
description:
9595
name: cupertino_icons
96-
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
96+
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
9797
url: "https://pub.dev"
9898
source: hosted
99-
version: "1.0.5"
99+
version: "1.0.6"
100100
fake_async:
101101
dependency: transitive
102102
description:
@@ -109,10 +109,10 @@ packages:
109109
dependency: transitive
110110
description:
111111
name: ffi
112-
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
112+
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
113113
url: "https://pub.dev"
114114
source: hosted
115-
version: "2.0.1"
115+
version: "2.1.0"
116116
file:
117117
dependency: transitive
118118
description:
@@ -158,10 +158,10 @@ packages:
158158
dependency: transitive
159159
description:
160160
name: glob
161-
sha256: c51b4fdfee4d281f49b8c957f1add91b815473597f76bcf07377987f66a55729
161+
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
162162
url: "https://pub.dev"
163163
source: hosted
164-
version: "2.1.0"
164+
version: "2.1.2"
165165
http_multi_server:
166166
dependency: transitive
167167
description:
@@ -187,10 +187,10 @@ packages:
187187
dependency: transitive
188188
description:
189189
name: io
190-
sha256: "0d4c73c3653ab85bf696d51a9657604c900a370549196a91f33e4c39af760852"
190+
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
191191
url: "https://pub.dev"
192192
source: hosted
193-
version: "1.0.3"
193+
version: "1.0.4"
194194
js:
195195
dependency: transitive
196196
description:
@@ -203,10 +203,10 @@ packages:
203203
dependency: transitive
204204
description:
205205
name: logging
206-
sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946
206+
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
207207
url: "https://pub.dev"
208208
source: hosted
209-
version: "1.1.0"
209+
version: "1.2.0"
210210
matcher:
211211
dependency: transitive
212212
description:
@@ -235,18 +235,18 @@ packages:
235235
dependency: transitive
236236
description:
237237
name: mime
238-
sha256: dab22e92b41aa1255ea90ddc4bc2feaf35544fd0728e209638cad041a6e3928a
238+
sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e
239239
url: "https://pub.dev"
240240
source: hosted
241-
version: "1.0.2"
241+
version: "1.0.4"
242242
node_preamble:
243243
dependency: transitive
244244
description:
245245
name: node_preamble
246-
sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d"
246+
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
247247
url: "https://pub.dev"
248248
source: hosted
249-
version: "2.0.1"
249+
version: "2.0.2"
250250
package_config:
251251
dependency: transitive
252252
description:
@@ -291,42 +291,42 @@ packages:
291291
dependency: transitive
292292
description:
293293
name: pub_semver
294-
sha256: b959af0a045c3484c4a8f4997731f5bfe4cac60d732fd8ce35b351f2d6a459fe
294+
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
295295
url: "https://pub.dev"
296296
source: hosted
297-
version: "2.1.2"
297+
version: "2.1.4"
298298
shelf:
299299
dependency: transitive
300300
description:
301301
name: shelf
302-
sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c
302+
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
303303
url: "https://pub.dev"
304304
source: hosted
305-
version: "1.4.0"
305+
version: "1.4.1"
306306
shelf_packages_handler:
307307
dependency: transitive
308308
description:
309309
name: shelf_packages_handler
310-
sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306
310+
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
311311
url: "https://pub.dev"
312312
source: hosted
313-
version: "3.0.1"
313+
version: "3.0.2"
314314
shelf_static:
315315
dependency: transitive
316316
description:
317317
name: shelf_static
318-
sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c
318+
sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
319319
url: "https://pub.dev"
320320
source: hosted
321-
version: "1.1.1"
321+
version: "1.1.2"
322322
shelf_web_socket:
323323
dependency: transitive
324324
description:
325325
name: shelf_web_socket
326-
sha256: "6db16374bc3497d21aa0eebe674d3db9fdf82082aac0f04dc7b44e4af5b08afc"
326+
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
327327
url: "https://pub.dev"
328328
source: hosted
329-
version: "1.0.2"
329+
version: "1.0.4"
330330
sky_engine:
331331
dependency: transitive
332332
description: flutter
@@ -336,18 +336,18 @@ packages:
336336
dependency: transitive
337337
description:
338338
name: source_map_stack_trace
339-
sha256: "8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11"
339+
sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae"
340340
url: "https://pub.dev"
341341
source: hosted
342-
version: "2.1.0"
342+
version: "2.1.1"
343343
source_maps:
344344
dependency: transitive
345345
description:
346346
name: source_maps
347-
sha256: "52de2200bb098de739794c82d09c41ac27b2e42fd7e23cce7b9c74bf653c7296"
347+
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
348348
url: "https://pub.dev"
349349
source: hosted
350-
version: "0.10.10"
350+
version: "0.10.12"
351351
source_span:
352352
dependency: transitive
353353
description:
@@ -424,10 +424,10 @@ packages:
424424
dependency: transitive
425425
description:
426426
name: typed_data
427-
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
427+
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
428428
url: "https://pub.dev"
429429
source: hosted
430-
version: "1.3.1"
430+
version: "1.3.2"
431431
vector_math:
432432
dependency: transitive
433433
description:
@@ -448,10 +448,10 @@ packages:
448448
dependency: transitive
449449
description:
450450
name: watcher
451-
sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
451+
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
452452
url: "https://pub.dev"
453453
source: hosted
454-
version: "1.0.2"
454+
version: "1.1.0"
455455
web:
456456
dependency: transitive
457457
description:
@@ -464,10 +464,10 @@ packages:
464464
dependency: transitive
465465
description:
466466
name: web_socket_channel
467-
sha256: "3a969ddcc204a3e34e863d204b29c0752716f78b6f9cc8235083208d268a4ccd"
467+
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
468468
url: "https://pub.dev"
469469
source: hosted
470-
version: "2.2.0"
470+
version: "2.4.0"
471471
webcrypto:
472472
dependency: "direct main"
473473
description:
@@ -487,18 +487,18 @@ packages:
487487
dependency: transitive
488488
description:
489489
name: webkit_inspection_protocol
490-
sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d"
490+
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
491491
url: "https://pub.dev"
492492
source: hosted
493-
version: "1.2.0"
493+
version: "1.2.1"
494494
yaml:
495495
dependency: transitive
496496
description:
497497
name: yaml
498-
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
498+
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
499499
url: "https://pub.dev"
500500
source: hosted
501-
version: "3.1.1"
501+
version: "3.1.2"
502502
sdks:
503503
dart: ">=3.1.0-185.0.dev <4.0.0"
504504
flutter: ">=3.0.0"

lib/src/boringssl/bindings/generated_bindings.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// AUTO GENERATED FILE, DO NOT EDIT.
1919
//
2020
// Generated by `package:ffigen`.
21+
// ignore_for_file: type=lint
2122
import 'dart:ffi' as ffi;
2223

2324
/// Bindings to src/webcrypto.h.

lib/src/testing/testing.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import 'utils/utils.dart';
1615
import 'utils/testrunner.dart' show TestRunner;
1716

1817
// TestRunner implementations
@@ -48,15 +47,20 @@ final _testRunners = <TestRunner>[
4847
rsassapkcs1v15.runner,
4948
];
5049

51-
/// Utility function that runs all tests using [test].
50+
/// Utility function that runs all tests using [testFn].
5251
///
5352
/// This makes it easy to run tests from `flutter drive`, when testing on a
5453
/// device.
55-
void runAllTests(TestFn test) {
56-
for (final r in _testRunners) {
57-
r.runTests(test: test);
54+
void runAllTests(
55+
void Function(String name, Future<void> Function() test) testFn,
56+
) {
57+
final allTests = [
58+
for (final r in _testRunners) ...r.tests(),
59+
...random.tests(),
60+
...digest.tests(),
61+
];
62+
63+
for (final (:name, :test) in allTests) {
64+
testFn(name, test);
5865
}
59-
// We don't use [TestRunner] for all tests, so we just add them manually.
60-
random.runTests(test: test);
61-
digest.runTests(test: test);
6266
}

lib/src/testing/utils/testrunner.dart

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import 'dart:convert';
1616
import 'dart:math';
1717
import 'dart:async';
1818

19-
import 'package:test/test.dart' show test;
2019
import 'package:meta/meta.dart';
2120
import 'package:webcrypto/webcrypto.dart';
2221
import 'detected_runtime.dart';
@@ -606,28 +605,32 @@ class TestRunner<PrivateKey, PublicKey> {
606605
return c.toJson();
607606
}
608607

609-
/// Run tests for [testData] using the given [test] function.
608+
/// Get test cases from [testData].
610609
///
611610
/// If no [testData] is given the `testData` given when the [TestRunner] was
612611
/// created will be used.
613612
///
614-
/// The [test] function must be compatible with `package:test/test.dart`.
615-
void runTests({
616-
TestFn test = test,
613+
/// Returns a list of tuples with test name and test function.
614+
List<({String name, Future<void> Function() test})> tests({
617615
Iterable<Map<dynamic, dynamic>>? testData,
618616
}) {
617+
final tests = <({String name, Future<void> Function() test})>[];
619618
testData ??= _testData;
620619
for (final data in testData) {
621620
final c = _TestCase.fromJson(data);
622621

623622
_runTests(this, c, (String name, FutureOr<void> Function() fn) {
624-
// Prefix test names
625-
test('$algorithm: ${c.name} -- $name', () async {
626-
// Check BoringSSL error stack if running with dart:ffi
627-
await checkErrorStack(fn);
628-
});
623+
tests.add((
624+
// Prefix test names
625+
name: '$algorithm: ${c.name} -- $name',
626+
test: () async {
627+
// Check BoringSSL error stack if running with dart:ffi
628+
await checkErrorStack(fn);
629+
}
630+
));
629631
});
630632
}
633+
return tests;
631634
}
632635
}
633636

0 commit comments

Comments
 (0)