kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/extractor/textproto/testdata/BUILD (about) 1 load("@bazel_skylib//:bzl_library.bzl", "bzl_library") 2 load(":textproto_extractor_test.bzl", "textproto_extractor_golden_test") 3 4 package(features = ["layering_check"]) 5 6 textproto_extractor_golden_test( 7 name = "simple", 8 srcs = ["simple.pbtxt"], 9 opts = [ 10 "--", 11 "--proto_path", 12 "kythe/cxx/extractor/textproto/testdata", 13 ], 14 deps = ["example.proto"], 15 ) 16 17 # This test specifies example_with_deps.proto as the main proto file, which 18 # should cause its dependency (deps.proto) to be extracted as well. 19 textproto_extractor_golden_test( 20 name = "deps", 21 srcs = ["deps.pbtxt"], 22 opts = [ 23 "--", 24 "--proto_path", 25 "kythe/cxx/extractor/textproto/testdata", 26 ], 27 deps = [ 28 "dep.proto", 29 "example_with_deps.proto", 30 ], 31 ) 32 33 # Test that specifying proto message and file via flags works. There are no 34 # schema comments in the textproto. 35 textproto_extractor_golden_test( 36 name = "without_schema", 37 srcs = ["without_schema.pbtxt"], 38 opts = [ 39 "--proto_files", 40 "example.proto", 41 "--proto_message", 42 "textproto_test.MyMessage", 43 "--", 44 "--proto_path", 45 "kythe/cxx/extractor/textproto/testdata", 46 ], 47 deps = [ 48 "example.proto", 49 ], 50 ) 51 52 # Test that the "# proto-import:" schema comment works. 53 textproto_extractor_golden_test( 54 name = "extra_imports", 55 srcs = ["extra_imports.pbtxt"], 56 opts = [ 57 "--", 58 "--proto_path", 59 "kythe/cxx/extractor/textproto/testdata", 60 ], 61 deps = [ 62 "dep.proto", 63 "example.proto", 64 ], 65 ) 66 67 # Test that --proto_files flag handles multiple protos correctly. 68 textproto_extractor_golden_test( 69 name = "multiple_proto_files", 70 srcs = ["without_schema.pbtxt"], 71 opts = [ 72 "--proto_message=textproto_test.MyMessage", 73 "--proto_files=example.proto,dep.proto", 74 "--", 75 "--proto_path", 76 "kythe/cxx/extractor/textproto/testdata", 77 ], 78 deps = [ 79 "dep.proto", 80 "example.proto", 81 ], 82 ) 83 84 # Test that KYTHE_CORPUS environment variable works. 85 textproto_extractor_golden_test( 86 name = "custom_corpus", 87 srcs = ["simple.pbtxt"], 88 extra_env = {"KYTHE_CORPUS": "custom_corpus"}, 89 opts = [ 90 "--", 91 "--proto_path", 92 "kythe/cxx/extractor/textproto/testdata", 93 ], 94 deps = ["example.proto"], 95 ) 96 97 # Test that KYTHE_ROOT_DIRECTORY environment variable works. File paths in the 98 # output should be relative to KYTHE_ROOT_DIRECTORY, not the extractor's working 99 # directory. 100 textproto_extractor_golden_test( 101 name = "subdir", 102 srcs = ["subdir/subdir.pbtxt"], 103 extra_env = {"KYTHE_ROOT_DIRECTORY": "kythe/cxx/extractor/textproto/testdata/subdir"}, 104 opts = [ 105 "--", 106 "--proto_path", 107 "kythe/cxx/extractor/textproto/testdata/subdir", 108 ], 109 deps = ["subdir/subdir.proto"], 110 ) 111 112 bzl_library( 113 name = "textproto_extractor_test_bzl", 114 srcs = ["textproto_extractor_test.bzl"], 115 )