From ca6c46441e0e9dde0f738a6a2b8513f0db27129d Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 12 Sep 2024 14:10:52 -0700 Subject: [PATCH] Move `zircon_tests` from `package:litetest` to `package:async_helper`. (flutter/engine#55149) The engine has historically used `package:litetest`, a home grown invention that is a wrapper around the Dart SDK. In https://github.com/flutter/flutter/issues/133569, we've moved over to the heavier weight `package:test`, which has been simplified since first evaluated by the Dart SDK vending the dependencies we need. The last user of `package:litetest` is a single test in the Fuchsia SDK, `zircon_tests`. This PR migrates the test from `litetest` (which will be deleted) to the Dart SK vendored `async_minittest`. For this simple test case, there is only a 1-line behavioral change (`notEquals(foo)` becomes `!= foo, true`), and it allows us to remove dependencies from the tree. --- .../platform/fuchsia/dart-pkg/zircon/BUILD.gn | 2 +- .../dart-pkg/zircon/test/zircon_tests.dart | 4 +- .../shell/platform/fuchsia/dart/BUILD.gn | 57 ++++++------------- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/BUILD.gn b/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/BUILD.gn index f8501b5c31..0d13ea12c4 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/BUILD.gn +++ b/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/BUILD.gn @@ -65,7 +65,7 @@ dart_library("zircon_tests_lib") { package_root = "test" sources = [ "zircon_tests.dart" ] - deps = [ "//flutter/shell/platform/fuchsia/dart:litetest" ] + deps = [ "//flutter/shell/platform/fuchsia/dart:async_helper" ] } flutter_component("zircon_tests_component") { diff --git a/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/test/zircon_tests.dart b/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/test/zircon_tests.dart index a0e380fb34..183295251c 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/test/zircon_tests.dart +++ b/engine/src/flutter/shell/platform/fuchsia/dart-pkg/zircon/test/zircon_tests.dart @@ -8,7 +8,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'dart:zircon'; -import 'package:litetest/litetest.dart'; +import 'package:async_helper/async_minitest.dart'; /// Helper method to turn a [String] into a [ByteData] containing the /// text of the string encoded as UTF-8. @@ -198,7 +198,7 @@ void main() { final HandleResult vmo = System.vmoCreate(0); expect(vmo.status, equals(ZX.OK)); int originalKoid = vmo.handle.koid; - expect(originalKoid, notEquals(ZX.KOID_INVALID)); + expect(originalKoid != ZX.KOID_INVALID, true); // Cached koid should be same value. expect(originalKoid, equals(vmo.handle.koid)); vmo.handle.close(); diff --git a/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn b/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn index 6586e16d4c..b2140f82b5 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn +++ b/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn @@ -59,7 +59,7 @@ dart_library("async_helper") { pubspec = "$package_root/pubspec.yaml" - deps = [] + deps = [ ":expect" ] sources = [ "async_helper.dart", @@ -67,6 +67,22 @@ dart_library("async_helper") { ] } +dart_library("expect") { + package_root = "$dart_src/pkg/expect" + package_name = "expect" + + pubspec = "$package_root/pubspec.yaml" + + deps = [] + + sources = [ + "config.dart", + "expect.dart", + "minitest.dart", + "variations.dart", + ] +} + dart_library("meta") { package_root = "$dart_src/pkg/meta" package_name = "meta" @@ -82,45 +98,6 @@ dart_library("meta") { ] } -dart_library("expect") { - package_root = "$dart_src/pkg/expect" - package_name = "expect" - - pubspec = "$package_root/pubspec.yaml" - - deps = [ ":meta" ] - - sources = [ - "config.dart", - "expect.dart", - "minitest.dart", - "variations.dart", - ] -} - -dart_library("litetest") { - package_root = "//flutter/testing/litetest" - package_name = "litetest" - - pubspec = "$package_root/pubspec.yaml" - - source_dir = "lib" - - deps = [ - ":async_helper", - ":expect", - ":meta", - ] - - sources = [ - "litetest.dart", - "src/async_minitest.dart", - "src/matchers.dart", - "src/test.dart", - "src/test_suite.dart", - ] -} - dart_library("args") { package_root = "$dart_src/third_party/pkg/args" package_name = "args"