diff options
Diffstat (limited to 'build2')
-rw-r--r-- | build2/test/testscript | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/build2/test/testscript b/build2/test/testscript index cf64e49..67304d7 100644 --- a/build2/test/testscript +++ b/build2/test/testscript @@ -126,7 +126,7 @@ EOE ~ What if we actually do want the output to go to a file, e.g., for a second command to act on it? Maybe keep shell syntax since familiar? Or reverse it (> - inline, >> - multiline, >>> to file). Simplest thing is the shortest, I - like it. + like it. What about appending to file - >>>> ? ~ $0 is target path (works out in case of a directory, but will be out). @@ -161,3 +161,26 @@ EOE ~ Clean up is tricky: sometimes we may want to keep it, but then how to clean it up later (the test might fail if there is junk present). Maybe create temp directory in out_base and run there? Will also help with parallel runs. + +~ We will need an ability to execute same command multiple times with some + argument variations. For simple cases the following idiom can be used: + + cmd = a b c + $cmd d e f # Expands to: a b c d e f + v=`$cmd x y z` + + The problem is that only the last arguments (of the last program in pipe) can + be varied. + + What if we can support variable templates with the following syntax: + + # Template variable definition. Same as a regular variable assignement but + # $n variables are not expanded and denotes template parameters. + # + cmd ~= a $1 b | c $2 + + # Instantiations. First n values that follows template variable expansion are + # template arguments. + # + $cmd d e f # Expands to: a d b | c e f + v=`$cmd x y` |