@@ -230,40 +230,67 @@ generate_library_failed_with_invalid_grpc_version() {
230
230
cleanup " ${destination} "
231
231
}
232
232
233
- get_config_from_valid_BUILD_matched_test () {
234
- build_file=" ${script_dir} /resources/misc/TESTBUILD.bazel"
235
- rule=" java_gapic_library("
236
- # the pattern we expect to find in the BUILD file
237
- pattern_should_match=" name"
238
- # default value if the pattern was not found
239
- if_matched_return=" got-a-match"
240
- if_not_matched_return=" no-match"
241
- pattern_matched_result=$( get_config_from_BUILD \
242
- " ${build_file} " \
243
- " ${rule} " \
244
- " ${pattern_should_match} " \
245
- " ${if_not_matched_return} " \
246
- " ${if_matched_return} "
247
- )
248
- assertEquals " ${if_matched_return} " " ${pattern_matched_result} "
249
- }
250
-
251
- get_config_from_valid_BUILD_not_match_test () {
252
- build_file=" ${script_dir} /resources/misc/TESTBUILD.bazel"
253
- rule=" java_gapic_library("
254
- # the pattern that we should not find in the BUILD file
255
- pattern_should_not_match=" should-not-match"
256
- # default value if the pattern was not found
257
- if_matched_return=" got-a-match"
258
- if_not_matched_return=" no-match"
259
- pattern_not_matched_result=$( get_config_from_BUILD \
260
- " ${build_file} " \
261
- " ${rule} " \
262
- " ${pattern_should_not_match} " \
263
- " ${if_not_matched_return} " \
264
- " ${if_matched_return} "
265
- )
266
- assertEquals " ${if_not_matched_return} " " ${pattern_not_matched_result} "
233
+ get_transport_from_BUILD_grpc_rest_test () {
234
+ local build_file=" ${script_dir} /resources/misc/BUILD_grpc_rest.bazel"
235
+ local transport
236
+ transport=$( get_transport_from_BUILD " ${build_file} " )
237
+ assertEquals " grpc+rest" " ${transport} "
238
+ }
239
+
240
+ get_transport_from_BUILD_grpc_test () {
241
+ local build_file=" ${script_dir} /resources/misc/BUILD_grpc.bazel"
242
+ local transport
243
+ transport=$( get_transport_from_BUILD " ${build_file} " )
244
+ assertEquals " grpc" " ${transport} "
245
+ }
246
+
247
+ get_transport_from_BUILD_rest_test () {
248
+ local build_file=" ${script_dir} /resources/misc/BUILD_rest.bazel"
249
+ local transport
250
+ transport=$( get_transport_from_BUILD " ${build_file} " )
251
+ assertEquals " rest" " ${transport} "
252
+ }
253
+
254
+ get_rest_numeric_enums_from_BUILD_true_test () {
255
+ local build_file=" ${script_dir} /resources/misc/BUILD_rest_numeric_enums_true.bazel"
256
+ local rest_numeric_enums
257
+ rest_numeric_enums=$( get_rest_numeric_enums_from_BUILD " ${build_file} " )
258
+ assertEquals " true" " ${rest_numeric_enums} "
259
+ }
260
+
261
+ get_rest_numeric_enums_from_BUILD_false_test () {
262
+ local build_file=" ${script_dir} /resources/misc/BUILD_rest_numeric_enums_false.bazel"
263
+ local rest_numeric_enums
264
+ rest_numeric_enums=$( get_rest_numeric_enums_from_BUILD " ${build_file} " )
265
+ assertEquals " false" " ${rest_numeric_enums} "
266
+ }
267
+
268
+ get_rest_numeric_enums_from_BUILD_empty_test () {
269
+ local build_file=" ${script_dir} /resources/misc/BUILD_rest_numeric_enums_empty.bazel"
270
+ local rest_numeric_enums
271
+ rest_numeric_enums=$( get_rest_numeric_enums_from_BUILD " ${build_file} " )
272
+ assertEquals " false" " ${rest_numeric_enums} "
273
+ }
274
+
275
+ get_include_samples_from_BUILD_true_test () {
276
+ local build_file=" ${script_dir} /resources/misc/BUILD_include_samples_true.bazel"
277
+ local include_samples
278
+ include_samples=$( get_include_samples_from_BUILD " ${build_file} " )
279
+ assertEquals " true" " ${include_samples} "
280
+ }
281
+
282
+ get_include_samples_from_BUILD_false_test () {
283
+ local build_file=" ${script_dir} /resources/misc/BUILD_include_samples_false.bazel"
284
+ local include_samples
285
+ include_samples=$( get_include_samples_from_BUILD " ${build_file} " )
286
+ assertEquals " false" " ${include_samples} "
287
+ }
288
+
289
+ get_include_samples_from_BUILD_empty_test () {
290
+ local build_file=" ${script_dir} /resources/misc/BUILD_include_samples_empty.bazel"
291
+ local include_samples
292
+ include_samples=$( get_include_samples_from_BUILD " ${build_file} " )
293
+ assertEquals " false" " ${include_samples} "
267
294
}
268
295
269
296
get_version_from_valid_WORKSPACE_test () {
@@ -312,8 +339,15 @@ test_list=(
312
339
generate_library_failed_with_invalid_generator_version
313
340
generate_library_failed_with_invalid_protobuf_version
314
341
generate_library_failed_with_invalid_grpc_version
315
- get_config_from_valid_BUILD_matched_test
316
- get_config_from_valid_BUILD_not_match_test
342
+ get_transport_from_BUILD_grpc_rest_test
343
+ get_transport_from_BUILD_grpc_test
344
+ get_transport_from_BUILD_rest_test
345
+ get_rest_numeric_enums_from_BUILD_true_test
346
+ get_rest_numeric_enums_from_BUILD_false_test
347
+ get_rest_numeric_enums_from_BUILD_empty_test
348
+ get_include_samples_from_BUILD_true_test
349
+ get_include_samples_from_BUILD_false_test
350
+ get_include_samples_from_BUILD_empty_test
317
351
get_version_from_valid_WORKSPACE_test
318
352
get_generator_version_from_valid_versions_txt_test
319
353
get_gax_version_from_valid_versions_txt_test
0 commit comments