Skip to content
Snippets Groups Projects

Add testFormat

Merged Loic Hausammann requested to merge format_unit_test into master
1 unresolved thread

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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=$?
  • added 1 commit

    Compare with previous version

  • I am now using command and set -e. Thanks for the suggestion :)

  • added 1 commit

    • b82b6e1a - Handle pipe errors more explicitly, failing at first command in the pipe was OK…

    Compare with previous version

  • Thanks, on second thoughts the set -e was no good when using format.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.

  • Everything seems to work on my computer. I am fine with your modifications.

  • Hopefully Jenkins is setup for this, so going to accept and see what happens.

  • Peter W. Draper mentioned in commit ec56acb4

    mentioned in commit ec56acb4

  • Please register or sign in to reply
    Loading