1*bcb5dc79SHONG Yifan# Gazelle test cases 2*bcb5dc79SHONG Yifan 3*bcb5dc79SHONG YifanThis directory contains a suite of test cases for the Skylark language plugin 4*bcb5dc79SHONG Yifanfor Gazelle. 5*bcb5dc79SHONG Yifan 6*bcb5dc79SHONG YifanPlease note that there are no `BUILD` or `BUILD.bazel` files in subdirs, instead 7*bcb5dc79SHONG Yifanthere are `BUILD.in` and `BUILD.out` describing what the `BUILD` should look 8*bcb5dc79SHONG Yifanlike initially and what the `BUILD` file should look like after the run. These 9*bcb5dc79SHONG Yifannames are special because they are not recognized by Bazel as a proper `BUILD` 10*bcb5dc79SHONG Yifanfile, and therefore are included in the data dependency by the recursive data 11*bcb5dc79SHONG Yifanglob in `//gazelle:go_default_test`. If you would like to include any extremely 12*bcb5dc79SHONG Yifancomplicated tests that contain proper `BUILD` files you will need to manually 13*bcb5dc79SHONG Yifanadd them to the `//gazelle:go_default_test` target's `data` section. 14*bcb5dc79SHONG Yifan 15*bcb5dc79SHONG Yifan## `simple` 16*bcb5dc79SHONG Yifan 17*bcb5dc79SHONG YifanSimple is a base test case that was used to validate the parser. 18*bcb5dc79SHONG Yifan 19*bcb5dc79SHONG Yifan## `nobuildfiles` 20*bcb5dc79SHONG Yifan 21*bcb5dc79SHONG YifanA test just like `simple` that has no `BUILD` files at the beginning. 22*bcb5dc79SHONG Yifan 23*bcb5dc79SHONG Yifan## `import` 24*bcb5dc79SHONG Yifan 25*bcb5dc79SHONG YifanImport is a test case that imports a `.bzl` from the same directory. 26*bcb5dc79SHONG Yifan 27*bcb5dc79SHONG Yifan## `multidir` 28*bcb5dc79SHONG Yifan 29*bcb5dc79SHONG YifanMultidir is a test that has a `.bzl` that imports from a different dirrectory. 30*bcb5dc79SHONG Yifan 31*bcb5dc79SHONG Yifan## `tests` 32*bcb5dc79SHONG Yifan 33*bcb5dc79SHONG YifanUsing the skylib as an example, this test has `.bzl` files that end in 34*bcb5dc79SHONG Yifan`_tests.bzl` which are `load`ed into `BUILD` files and never imported by 35*bcb5dc79SHONG Yifananother repo. 36*bcb5dc79SHONG Yifan 37*bcb5dc79SHONG Yifan## `private` 38*bcb5dc79SHONG Yifan 39*bcb5dc79SHONG YifanUsing the skylib as an example, this test has `.bzl` files that live in a 40*bcb5dc79SHONG Yifandirectory called `private` which is used to indicate that they are repo private. 41*bcb5dc79SHONG YifanNote that this is distict from the expectations of go's `internal` where the 42*bcb5dc79SHONG Yifanrelative position in the hierarchy determines the visibility. 43*bcb5dc79SHONG Yifan 44*bcb5dc79SHONG Yifan## `defaultvisibility` 45*bcb5dc79SHONG Yifan 46*bcb5dc79SHONG YifanIf the package declares a `default_visibility` the generated `bzl_library` 47*bcb5dc79SHONG Yifanshould not set its own `visibility`. 48*bcb5dc79SHONG Yifan 49*bcb5dc79SHONG Yifan## `external` 50*bcb5dc79SHONG Yifan 51*bcb5dc79SHONG YifanThis test demonstrates that if you load from another repo, it is able to 52*bcb5dc79SHONG Yifangenerate a `deps` entry for the dependency. 53*bcb5dc79SHONG Yifan 54*bcb5dc79SHONG Yifan## `empty` 55*bcb5dc79SHONG Yifan 56*bcb5dc79SHONG YifanGazelle has the ability to remove old and unused targets. Test that. 57