BUILD 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
  5. load("@rules_tree_sitter//tree_sitter:tree_sitter.bzl", "tree_sitter_cc_library")
  6. package(default_visibility = [
  7. "//bazel/check_deps:__pkg__",
  8. "//installers:__subpackages__",
  9. ])
  10. tree_sitter_cc_library(
  11. name = "treesitter",
  12. srcs = ["src/scanner.c"],
  13. grammar = ["grammar.js"],
  14. )
  15. cc_binary(
  16. name = "test_runner",
  17. testonly = 1,
  18. srcs = ["test_runner.cpp"],
  19. deps = [
  20. ":treesitter",
  21. ],
  22. )
  23. cc_test(
  24. name = "explorer_tests",
  25. size = "small",
  26. srcs = ["test_runner.cpp"],
  27. args = ["$(locations //explorer:treesitter_testdata)"],
  28. data = ["//explorer:treesitter_testdata"],
  29. deps = [
  30. ":treesitter",
  31. ],
  32. )
  33. filegroup(
  34. name = "string_testdata",
  35. srcs = glob(
  36. ["testdata/string/*.carbon"],
  37. exclude = ["testdata/string/fail_*.carbon"],
  38. ),
  39. )
  40. filegroup(
  41. name = "string_fail_testdata",
  42. srcs = glob(["testdata/string/fail_*.carbon"]),
  43. )
  44. cc_test(
  45. name = "string_tests",
  46. size = "small",
  47. srcs = ["test_runner.cpp"],
  48. args = ["$(locations :string_testdata)"],
  49. data = [":string_testdata"],
  50. deps = [
  51. ":treesitter",
  52. ],
  53. )
  54. cc_test(
  55. name = "string_fail_tests",
  56. size = "small",
  57. srcs = ["test_runner.cpp"],
  58. args = ["$(locations :string_fail_testdata)"],
  59. data = [":string_fail_testdata"],
  60. env = {
  61. "FAIL_TESTS": "1",
  62. },
  63. deps = [
  64. ":treesitter",
  65. ],
  66. )