diff options
author | irengrig <ichern@google.com> | 2020-02-27 19:29:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 13:29:45 -0500 |
commit | 6970e21d290ceaa36502d0c94533b26e5ec18c0b (patch) | |
tree | 5eddd92ab8d35047c0676d7cbc00e22951bb85b3 /tests | |
parent | add8e42934d1bf63ecf27f5439574383e74ef8fc (diff) | |
download | bazel-skylib-6970e21d290ceaa36502d0c94533b26e5ec18c0b.tar.gz |
Create a helper rule for selecting a file from outputs of another rul… (#233)
* Create a helper rule for selecting a file from outputs of another rule or a filegroup by subpath
* Add tests
* Address code review comments
* + formatting
Co-authored-by: c-parsons <cparsons@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/select_file/BUILD | 34 | ||||
-rw-r--r-- | tests/select_file/select_me.txt | 1 | ||||
-rw-r--r-- | tests/select_file/subdir/inner.txt | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/select_file/BUILD b/tests/select_file/BUILD new file mode 100644 index 0000000..e795502 --- /dev/null +++ b/tests/select_file/BUILD @@ -0,0 +1,34 @@ +load("//rules:select_file.bzl", "select_file") +load("//rules:diff_test.bzl", "diff_test") + +filegroup( + name = "fg", + srcs = [ + "subdir/inner.txt", + ":select_me.txt", + ], +) + +select_file( + name = "select_me", + srcs = ":fg", + subpath = "select_me.txt", +) + +select_file( + name = "select_inner", + srcs = ":fg", + subpath = "subdir/inner.txt", +) + +diff_test( + name = "selected_me", + file1 = ":select_me", + file2 = ":select_me.txt", +) + +diff_test( + name = "selected_inner", + file1 = ":select_inner", + file2 = "subdir/inner.txt", +) diff --git a/tests/select_file/select_me.txt b/tests/select_file/select_me.txt new file mode 100644 index 0000000..4221a1e --- /dev/null +++ b/tests/select_file/select_me.txt @@ -0,0 +1 @@ +Outer diff --git a/tests/select_file/subdir/inner.txt b/tests/select_file/subdir/inner.txt new file mode 100644 index 0000000..d87e45a --- /dev/null +++ b/tests/select_file/subdir/inner.txt @@ -0,0 +1 @@ +Inner |