Add testFormat
Here is an implementation of a unit test checking if swift is well formatted.
I decided to improve the format.sh
script and just call it from a test script (simplify any future modifications of the format)
Merge request reports
Activity
Thanks for implementing this!
Looks good to me, but I can't test it myself right now, so punting to @pdraper.
assigned to @pdraper
29 ;; 30 # unknown option 31 *) 32 echo "Argument '$1' not implemented" 33 show_help 34 exit 35 ;; 36 esac 37 done 38 39 # Run the required commands 40 if [[ $TEST -eq 1 ]] 41 then 42 echo "Testing Swift formatting" 43 $cmd -output-replacements-xml | grep -c "<replacement " >/dev/null 44 res=$? changed this line in version 3 of the diff
added 1 commit
- b82b6e1a - Handle pipe errors more explicitly, failing at first command in the pipe was OK…
Thanks, on second thoughts the
set -e
was no good when usingformat.sh -t
interactively, so I've added some more painful bash-isms to handle this. We also need to use a different command on COSMA (the command is clang-format, regardless of version), so you can use an environment variable to change that.Please check this all. If OK I'll accept.
mentioned in commit ec56acb4