File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ set -e
2+ set -x
3+ cd tests/
4+ mkdir -p ./tmp/
5+ cd ./tmp/
6+
7+ # Set up the project we will build:
8+ cp ../shell/043_replace_version/example-cfbs.json ./cfbs.json
9+ mkdir -p subdir
10+ cp ../shell/043_replace_version/subdir/example.py ./subdir/example.py
11+
12+ # Before building, version number is 0.0.0:
13+ grep ' print("Version: 0.0.0")' ./subdir/example.py
14+ ! grep ' print("Version: 1.2.3")' ./subdir/example.py
15+
16+ cfbs build
17+
18+ # After building, input and output should be different:
19+ ! diff ./subdir/example.py ./out/masterfiles/services/cfbs/subdir/example.py
20+
21+ # Check that version number is correct in output:
22+ grep ' print("Version: 1.2.3")' ./out/masterfiles/services/cfbs/subdir/example.py
23+ ! grep ' print("Version: 0.0.0")' ./out/masterfiles/services/cfbs/subdir/example.py
24+
25+ # Also check that the input was not modified:
26+ grep ' print("Version: 0.0.0")' ./subdir/example.py
27+ ! grep ' print("Version: 1.2.3")' ./subdir/example.py
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " Example project" ,
3+ "description" : " Example description" ,
4+ "type" : " policy-set" ,
5+ "git" : true ,
6+ "build" : [
7+ {
8+ "name" : " ./subdir/" ,
9+ "description" : " Local subdirectory added using cfbs command line" ,
10+ "added_by" : " cfbs add" ,
11+ "version" : " 1.2.3" ,
12+ "steps" : [
13+ " copy example.py services/cfbs/subdir/example.py" ,
14+ " replace_version services/cfbs/subdir/example.py 0.0.0"
15+ ]
16+ }
17+ ]
18+ }
Original file line number Diff line number Diff line change 1+ if __name__ == "__main__" :
2+ print ("Version: 0.0.0" )
Original file line number Diff line number Diff line change @@ -46,5 +46,6 @@ bash tests/shell/039_add_added_by_field_update_1.sh
4646bash tests/shell/040_add_added_by_field_update_2.sh
4747bash tests/shell/041_add_multidep.sh
4848bash tests/shell/042_update_from_url.sh
49+ bash tests/shell/043_replace_version.sh
4950
5051echo " All cfbs shell tests completed successfully!"
You can’t perform that action at this time.
0 commit comments