diff options
author | Cole Faust <colefaust@google.com> | 2023-02-07 12:28:47 -0800 |
---|---|---|
committer | Cole Faust <colefaust@google.com> | 2023-02-07 12:28:47 -0800 |
commit | 2b5b3f3be8e39f1a79468f730641b6d6ec20c153 (patch) | |
tree | 007864bb25be4e0582a462a88a7596dce27802f6 /tests | |
parent | 1f5aa1143775e61518001b4ef730976ba3ba6f1a (diff) | |
download | build-2b5b3f3be8e39f1a79468f730641b6d6ec20c153.tar.gz |
Make words() work on a list of non-strings
words() attempts to join all the elements of a list
and then resplit them to more closely match make.
But sometimes, like when calling words() on a product
variable, not all of the elements are strings. In
that case, just return the list unchanged.
Bug: 267407943
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: I738d0c86c8935f446807cc79623f796e8cae3c01
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run.rbc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/run.rbc b/tests/run.rbc index 1b51719e6f..33583eb3cd 100644 --- a/tests/run.rbc +++ b/tests/run.rbc @@ -46,6 +46,11 @@ assert_eq("", rblf.mkstrip(" \n \t ")) assert_eq("a b c", rblf.mkstrip(" a b \n c \t")) assert_eq("1", rblf.mkstrip("1 ")) +assert_eq(["a", "b"], rblf.words("a b")) +assert_eq(["a", "b", "c"], rblf.words(["a b", "c"])) +# 1-tuple like we use in product variables +assert_eq(["a b", ("c",)], rblf.words(["a b", ("c",)])) + assert_eq("b1 b2", rblf.mksubst("a", "b", "a1 a2")) assert_eq(["b1", "x2"], rblf.mksubst("a", "b", ["a1", "x2"])) |