BUILD 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. tree_sitter_cc_library(
  7. name = "treesitter",
  8. srcs = ["src/scanner.c"],
  9. grammar = ["grammar.js"],
  10. )
  11. cc_binary(
  12. name = "test_runner",
  13. srcs = ["test_runner.cpp"],
  14. deps = [
  15. ":treesitter",
  16. ],
  17. )
  18. cc_test(
  19. name = "explorer_tests",
  20. srcs = ["test_runner.cpp"],
  21. args = ["$(locations //explorer:treesitter_testdata)"],
  22. data = ["//explorer:treesitter_testdata"],
  23. deps = [
  24. ":treesitter",
  25. ],
  26. )
  27. filegroup(
  28. name = "string_testdata",
  29. srcs = glob(
  30. ["testdata/string/*.carbon"],
  31. exclude = ["testdata/string/fail_*.carbon"],
  32. ),
  33. )
  34. filegroup(
  35. name = "string_fail_testdata",
  36. srcs = glob(["testdata/string/fail_*.carbon"]),
  37. )
  38. cc_test(
  39. name = "string_tests",
  40. srcs = ["test_runner.cpp"],
  41. args = ["$(locations :string_testdata)"],
  42. data = [":string_testdata"],
  43. deps = [
  44. ":treesitter",
  45. ],
  46. )
  47. cc_test(
  48. name = "string_fail_tests",
  49. srcs = ["test_runner.cpp"],
  50. args = ["$(locations :string_fail_testdata)"],
  51. data = [":string_fail_testdata"],
  52. env = {
  53. "FAIL_TESTS": "1",
  54. },
  55. deps = [
  56. ":treesitter",
  57. ],
  58. )