| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Usage:
 | 
| 4 | #   demo/ninja.sh <function name>
 | 
| 5 | 
 | 
| 6 | set -o nounset
 | 
| 7 | set -o pipefail
 | 
| 8 | set -o errexit
 | 
| 9 | 
 | 
| 10 | test-ninja-quoting() {
 | 
| 11 |   touch _tmp/{in1,in2}
 | 
| 12 |   ninja -f demo/demo.ninja
 | 
| 13 | }
 | 
| 14 | 
 | 
| 15 | test-shell() {
 | 
| 16 |   # Same thing as Ninja
 | 
| 17 | 
 | 
| 18 |   out='_tmp/out1 _tmp/out2'
 | 
| 19 |   in='_tmp/in1 _tmp/in2'
 | 
| 20 |   empty=''
 | 
| 21 |   sq="''"
 | 
| 22 |   spaces='foo bar'
 | 
| 23 | 
 | 
| 24 |   local command="spec/bin/argv.py $out $empty $in $sq $spaces"
 | 
| 25 | 
 | 
| 26 |   # note the same!  Because it's word split, and then '' comes through as a
 | 
| 27 |   # word
 | 
| 28 |   $command
 | 
| 29 | 
 | 
| 30 |   # This is the same!
 | 
| 31 |   eval "$command"
 | 
| 32 | }
 | 
| 33 | 
 | 
| 34 | "$@"
 |