| # Copyright 2026 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| load("//build/bazel/rules/cc:fx_cc_test_binary.bzl", "fx_cc_test_binary") | |
| load("//build/bazel/rules/packages:fx_package.bzl", "fx_package") | |
| load("//build/bazel/rules/testing:fx_test.bzl", "fx_test") | |
| load("//build/bazel/rules/testing:fx_unittest_component.bzl", "fx_unittest_component") | |
| package(default_applicable_licenses = ["//:license"]) | |
| test_suite( | |
| name = "tests", | |
| tests = [":async_patterns_testing_tests"], | |
| visibility = ["//sdk/lib:__pkg__"], | |
| ) | |
| # Unrolled from GN sdk_cpp_test("bin") across all SDK-supported C++ standards | |
| # (C++17, C++20, C++23). | |
| fx_cc_test_binary( | |
| name = "bin-cxx17", | |
| srcs = ["dispatcher_bound_test.cc"], | |
| build_flags = ["//build/config:c++17"], | |
| deps = [ | |
| "//sdk/lib/async:async-cpp", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async_patterns/testing/cpp", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/lib/testing/predicates", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| fx_cc_test_binary( | |
| name = "bin-cxx20", | |
| srcs = ["dispatcher_bound_test.cc"], | |
| build_flags = ["//build/config:c++20"], | |
| deps = [ | |
| "//sdk/lib/async:async-cpp", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async_patterns/testing/cpp", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/lib/testing/predicates", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| fx_cc_test_binary( | |
| name = "bin-cxx23", | |
| srcs = ["dispatcher_bound_test.cc"], | |
| build_flags = ["//build/config:c++23"], | |
| deps = [ | |
| "//sdk/lib/async:async-cpp", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async_patterns/testing/cpp", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/lib/testing/predicates", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| # Preserve the component names generated by GN's `sdk_cpp_unittest_package()` | |
| # so `tests.json` URLs and ResultDB test history remain unchanged. | |
| fx_unittest_component( | |
| name = "bin-cxx17-component", | |
| binary = ":bin-cxx17", | |
| component_name = "_sdk_cpp_unittest_package.async_patterns_testing_tests.component-cxx17", | |
| ) | |
| fx_unittest_component( | |
| name = "bin-cxx20-component", | |
| binary = ":bin-cxx20", | |
| component_name = "_sdk_cpp_unittest_package.async_patterns_testing_tests.component-cxx20", | |
| ) | |
| fx_unittest_component( | |
| name = "bin-cxx23-component", | |
| binary = ":bin-cxx23", | |
| component_name = "_sdk_cpp_unittest_package.async_patterns_testing_tests.component-cxx23", | |
| ) | |
| fx_package( | |
| name = "async_patterns_testing_tests_package", | |
| package_name = "async_patterns_testing_tests", | |
| test_components = [ | |
| ":bin-cxx17-component", | |
| ":bin-cxx20-component", | |
| ":bin-cxx23-component", | |
| ], | |
| ) | |
| fx_test( | |
| name = "async_patterns_testing_tests", | |
| package = ":async_patterns_testing_tests_package", | |
| ) |