diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-19 12:23:10 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-20 16:01:40 +0200 |
commit | 88640e677fa0695783eac68014d7d8d5bc42d117 (patch) | |
tree | b1de045dc2d8d290422aaebbfbdbe184e8074dfd /tests/function/string/testscript | |
parent | bed6b6a9170253e010cbffd59202add4edfd1c2b (diff) |
Add string_set buildfile value type
This exposes the std::set<std::string> type to buildfiles.
New functions:
$size(<string-set>)
Subscript returns true if the value is present and false otherwise (so
it is mapped to std::set::contains()). For example:
set = [string_set] a b c
if ($set[b])
...
Note that append (+=) and prepend (=+) have the same semantics
(std::set::insert()). For example:
set = [string_set] a b
set += c b # a b c
set =+ d b # a b c d
Example of iteration:
set = [string_set] a b c
for k: $set
...
Diffstat (limited to 'tests/function/string/testscript')
-rw-r--r-- | tests/function/string/testscript | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/function/string/testscript b/tests/function/string/testscript index a363cc3..96f5c52 100644 --- a/tests/function/string/testscript +++ b/tests/function/string/testscript @@ -46,7 +46,8 @@ $* <'print $size([string] abc)' >'3' : basics $* <'print $size([string] )' >'0' : zero $* <'print $size([strings] a b c)' >'3' : strings - $* <'print $size([string_map] a@1 b@2 c@3)' >'3' : string_map + $* <'print $size([string_set] a b b)' >'2' : string-set + $* <'print $size([string_map] a@1 b@2 b@3)' >'2' : string-map } : find |