@@ -64,22 +64,104 @@ Other languages and concerns may add their owns.
6464If the amount of options is a little overwhelming for you, you can
6565write them down to a file and let `` byexample `` load them for you.
6666
67- The only convention that you need to follow is to write one option
68- per line and use `` = `` for the arguments.
67+ The only convention that you need to follow is to write ** one** option
68+ per line. If the option receives one argument you can separate them by
69+ ` = ` or by a space but if there is more than one argument you will have
70+ to write the option and the arguments one by one in its own line.
6971
7072``` shell
7173$ cat test/ds/options_file
72- -l=python
73- --options=" +norm-ws"
74+ # Options and their arguments are separated by a = or by a space
75+ -l python
76+ --options=+norm-ws
77+ < ...>
78+ # But if the option receives more than one argument, all of them
79+ # must be in its own line
80+ --skip
81+ test/ds/pkg/foo1.py
82+ test/ds/pkg/foo2.py
83+ < ...>
84+ # This wouldn't work:
85+ # --skip test/ds/pkg/foo1.py test/ds/pkg/foo2.py
86+ < ...>
7487```
7588
7689Then load it with `` @ `` and the file; you can use multiple files
7790and combine them with more options from the command line:
7891
7992``` shell
80- $ byexample @test/ds/options_file test/ds/python-tutorial.v2.md
93+ $ byexample @test/ds/options_file -- test/ds/python-tutorial.v2.md
8194< ...>
8295File test/ds/python-tutorial.v2.md, 4/4 test ran in < ...> seconds
8396[PASS] Pass: 4 Fail: 0 Skip: 0
8497```
8598
99+ > ** Note:** before ` 10.5.2 ` the options in the file required to be followed by an
100+ > ` = ` like ` -l=python ` ; spaces were not allowed.
101+
102+ ## File pattern expansions
103+
104+ Consider the following:
105+
106+ ``` shell
107+ $ byexample -l python test/ds/pkg/* .py | grep pkg | sort # byexample: +timeout=8
108+ File test/ds/pkg/bar1.py, 1/1 test ran in < ...> seconds
109+ File test/ds/pkg/foo1.py, 1/1 test ran in < ...> seconds
110+ File test/ds/pkg/foo2.py, 1/1 test ran in < ...> seconds
111+ ```
112+
113+ Your * shell* usually expands ` test/ds/pkg/*.py ` into a list of files:
114+ ` test/ds/pkg/bar1.py ` , ` test/ds/pkg/foo1.py ` and ` test/ds/pkg/foo2.py `
115+
116+ The same happens with the argument list for ` --skip ` , it is expanded by
117+ your * shell* .
118+
119+ ``` shell
120+ $ byexample -l python --skip test/ds/pkg/foo* -- test/ds/pkg/* .py | grep pkg | sort # byexample: +timeout=8
121+ File test/ds/pkg/bar1.py, 1/1 test ran in < ...> seconds
122+ ```
123+
124+ Since ` 10.0.3 ` , ` byexample ` does the same expansion even if you shell does not.
125+ This is in particular useful if the list of files is in a file (where your shell
126+ never ever see).
127+
128+ ``` shell
129+ $ cat test/ds/pkg/bopts
130+ --skip=test/ds/pkg/foo* .py
131+ --
132+ test/ds/pkg/* .py
133+
134+ $ byexample -l python @test/ds/pkg/bopts | grep pkg | sort # byexample: +timeout=8
135+ File test/ds/pkg/bar1.py, 1/1 test ran in < ...> seconds
136+ ```
137+
138+ <!--
139+
140+ Extra test checking that options in a file with multiple spaces are
141+ interpreted correctly now that we support separate the flag from its
142+ value with a space (before an '=' was always required)
143+
144+ So the following lines are equivalent
145+ -skip=foo bar
146+ -skip foo bar
147+
148+ $ cat test/ds/pkg/bopts2
149+ <...>skip
150+ test/ds/pkg/foo1.py
151+ test/ds/pkg/foo2.py
152+ <...>
153+
154+ $ byexample -l python @test/ds/pkg/bopts2 | grep pkg | wc -l # byexample: +timeout=8
155+ 1
156+
157+ $ cat test/ds/pkg/bopts3
158+ <...>skip=test/ds/pkg/foo1.py test/ds/pkg/foo2.py
159+ <...>
160+
161+ $ byexample -l python @test/ds/pkg/bopts2 | grep pkg | wc -l # byexample: +timeout=8
162+ 1
163+
164+ $ byexample -l python @test/ds/pkg/bopts | grep pkg | wc -l # byexample: +timeout=8
165+ 1
166+
167+ -->
0 commit comments