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 *.map files so they aren't | 9 # Arguments passed to the diff tool. We exclude: |
10 # compared, as the diff is not human readable. | 10 # - *.map files so they aren't compared, as the diff is not human readable. |
11 DIFF_ARGS="-u -r -N --exclude=\*.map expect actual" | 11 # - runtime JS files that are just copied over from the sources and are not |
| 12 # duplicated in the expected folder. |
| 13 DIFF_ARGS="-u -r -N --exclude=\*.map --exclude=dart_runtime.js \ |
| 14 --exclude=harmony_feature_check.js expect actual" |
12 | 15 |
13 function show_diff { | 16 function show_diff { |
14 echo "Fail: actual output did not match expected" | 17 echo "Fail: actual output did not match expected" |
15 echo | 18 echo |
16 diff $DIFF_ARGS |\ | 19 diff $DIFF_ARGS |\ |
17 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 20 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
18 sed -e "s/^\(-.*\)/[31m\1[0m/" | 21 sed -e "s/^\(-.*\)/[31m\1[0m/" |
19 echo | 22 echo |
20 echo "You can update these expectations with:" | 23 echo "You can update these expectations with:" |
21 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | 24 echo "$ pushd `pwd` && cp -a actual/* expect && popd" |
22 fail | 25 fail |
23 } | 26 } |
24 | 27 |
25 # the directory of this script | 28 # the directory of this script |
26 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) | 29 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) |
27 | 30 |
28 # Some tests require being run from the package root | 31 # Some tests require being run from the package root |
29 cd $TEST_DIR/.. | 32 cd $TEST_DIR/.. |
30 | 33 |
31 # Check minimum SDK version | 34 # Check minimum SDK version |
32 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail | 35 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail |
33 | 36 |
34 # Remove packages symlinks, and old codegen output | 37 # Remove packages symlinks, and old codegen output |
35 find test/codegen -name packages -exec rm {} \; | 38 find test/codegen -name packages -exec rm {} \; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 # * local files that have never been added to git, | 75 # * local files that have never been added to git, |
73 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 76 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
74 # contain a lot of generated or external source we should not reformat. | 77 # contain a lot of generated or external source we should not reformat. |
75 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ | 78 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ |
76 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ | 79 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ |
77 && echo "Did not run the formatter, please commit edited files first." \ | 80 && echo "Did not run the formatter, please commit edited files first." \ |
78 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 81 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
79 popd &> /dev/null | 82 popd &> /dev/null |
80 | 83 |
81 echo -e "[32mAll tests pass[0m" | 84 echo -e "[32mAll tests pass[0m" |
OLD | NEW |