|
| 1 | +load("@rules_rust//rust:defs.bzl", "rust_test") |
1 | 2 | load("//misc/bazel:rust.bzl", "codeql_rust_binary") |
2 | 3 | load("//misc/bazel/3rdparty/tree_sitter_extractors_deps:defs.bzl", "aliases", "all_crate_deps") |
3 | 4 | load("//unified:platforms.bzl", "UNIFIED_SUPPORTED_PLATFORMS") |
@@ -29,3 +30,54 @@ codeql_rust_binary( |
29 | 30 | "//unified/swift-syntax-rs:swift_syntax_rs", |
30 | 31 | ], |
31 | 32 | ) |
| 33 | + |
| 34 | +_TESTS = { |
| 35 | + "corpus_tests": { |
| 36 | + "data": glob(["tests/corpus/**"]), |
| 37 | + "compile_data": [], |
| 38 | + "size": "medium", |
| 39 | + }, |
| 40 | + # `include_str!`s a checked-in `parse_to_json` dump. |
| 41 | + "swift_syntax_pipeline": { |
| 42 | + "data": [], |
| 43 | + "compile_data": glob(["tests/fixtures/**"]), |
| 44 | + "size": "small", |
| 45 | + }, |
| 46 | +} |
| 47 | + |
| 48 | +[ |
| 49 | + rust_test( |
| 50 | + name = test_name, |
| 51 | + size = spec["size"], |
| 52 | + srcs = ["tests/%s.rs" % test_name] + glob(["src/**/*.rs"]), |
| 53 | + aliases = aliases(), |
| 54 | + compile_data = [ |
| 55 | + "ast_types.yml", |
| 56 | + "swift_node_types.yml", |
| 57 | + ] + spec["compile_data"], |
| 58 | + crate_root = "tests/%s.rs" % test_name, |
| 59 | + data = spec["data"] + select({ |
| 60 | + "@platforms//os:linux": ["//unified/swift-syntax-rs:swift_runtime_libs"], |
| 61 | + "//conditions:default": [], |
| 62 | + }), |
| 63 | + edition = "2024", |
| 64 | + proc_macro_deps = all_crate_deps( |
| 65 | + proc_macro = True, |
| 66 | + ), |
| 67 | + rustc_flags = ["--cfg=bazel"], |
| 68 | + target_compatible_with = UNIFIED_SUPPORTED_PLATFORMS, |
| 69 | + deps = all_crate_deps( |
| 70 | + normal = True, |
| 71 | + ) + [ |
| 72 | + "//shared/tree-sitter-extractor", |
| 73 | + "//shared/yeast", |
| 74 | + "//unified/swift-syntax-rs:swift_syntax_rs", |
| 75 | + ], |
| 76 | + ) |
| 77 | + for test_name, spec in _TESTS.items() |
| 78 | +] |
| 79 | + |
| 80 | +test_suite( |
| 81 | + name = "all_tests", |
| 82 | + tests = [":%s" % test_name for test_name in _TESTS], |
| 83 | +) |
0 commit comments