| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 set -e # bail on error | 2 set -e # bail on error |
| 3 | 3 |
| 4 function fail { | 4 function fail { |
| 5 echo -e "[31mSome tests failed[0m" | 5 echo -e "[31mSome tests failed[0m" |
| 6 return 1 | 6 return 1 |
| 7 } | 7 } |
| 8 | 8 |
| 9 # Arguments passed to the diff tool. We exclude: | 9 # Arguments passed to the diff tool. We exclude: |
| 10 # - *.map files so they aren't compared, as the diff is not human readable. | 10 # - *.map files so they aren't compared, as the diff is not human readable. |
| 11 # - runtime JS files that are just copied over from the sources and are not | 11 # - runtime JS files that are just copied over from the sources and are not |
| 12 # duplicated in the expected folder. | 12 # duplicated in the expected folder. |
| 13 DIFF_ARGS="-u -r -N --exclude=\*.map \ | 13 DIFF_ARGS="-u -r -N --exclude=\*.map \ |
| 14 --exclude=dart_runtime.js \ | 14 --exclude=dart_runtime.js \ |
| 15 --exclude=dart_core.js \ |
| 15 --exclude=harmony_feature_check.js \ | 16 --exclude=harmony_feature_check.js \ |
| 16 --exclude=messages_widget.js \ | 17 --exclude=messages_widget.js \ |
| 17 --exclude=messages.css \ | 18 --exclude=messages.css \ |
| 18 expect actual" | 19 expect actual" |
| 19 | 20 |
| 20 function show_diff { | 21 function show_diff { |
| 21 echo "Fail: actual output did not match expected" | 22 echo "Fail: actual output did not match expected" |
| 22 echo | 23 echo |
| 23 diff $DIFF_ARGS |\ | 24 diff $DIFF_ARGS |\ |
| 24 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 25 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 # * local files that have never been added to git, | 80 # * local files that have never been added to git, |
| 80 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 81 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
| 81 # contain a lot of generated or external source we should not reformat. | 82 # contain a lot of generated or external source we should not reformat. |
| 82 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ | 83 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ |
| 83 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ | 84 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ |
| 84 && echo "Did not run the formatter, please commit edited files first." \ | 85 && echo "Did not run the formatter, please commit edited files first." \ |
| 85 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 86 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
| 86 popd &> /dev/null | 87 popd &> /dev/null |
| 87 | 88 |
| 88 echo -e "[32mAll tests pass[0m" | 89 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |