-
-
Save jiahaog/ca2c8aeca21ac89a920ca9a6ac4d7d97 to your computer and use it in GitHub Desktop.
Move files to match the directory conventions of `package:integration_test`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Move files to match the directory conventions of `package:integration_test`. | |
# | |
# - Test script that runs on the device should go in `integration_test/`, e.g. `integration_test/local_auth_test.dart` | |
# - Driver script that runs on the host should go in `test_driver`, e.g. `test_driver/integration_test_driver`. | |
# | |
# The CI script has already been updated in flutter/plugin_tools#105 | |
# | |
# See https://github.com/flutter/plugins/blob/master/packages/integration_test/README.md | |
# for more details. | |
# | |
# More examples: | |
# - Test that runs on the device: | |
# - packages/local_auth/test/local_auth_e2e.dart -> packages/local_auth/integration_test/local_auth_test.dart | |
# - packages/shared_preferences/shared_preferences/example/test_driver/shared_preferences_e2e.dart packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart | |
# - Host driver script: | |
# - packages/package_info/example/test_driver/package_info_e2e_test.dart -> packages/package_info/example/test_driver/integration_test.dart | |
set -euo pipefail | |
for file in $(git ls-files | grep e2e) | |
do | |
if [[ "$file" =~ e2e\.dart$ ]]; then | |
# Test file that runs on the device. | |
new_dir="$(dirname $file)/../integration_test" | |
new_filename=$(basename "$file" | sed 's/_e2e_test.dart/_test.dart/' | sed 's/_e2e.dart/_test.dart/') | |
mkdir -p "$new_dir" && git mv "$file" "$new_dir/$new_filename" | |
elif [[ "$file" =~ test_driver ]]; then | |
# Host driver script. | |
git mv "$file" "$(dirname $file)/integration_test.dart" | |
else | |
echo "[ERROR] Unknown file matched: $file" >&2 | |
fi | |
done | |
extra_test_lib=packages/google_maps_flutter/google_maps_flutter/example/test_driver/google_map_inspector.dart | |
[[ -f "$extra_test_lib" ]] && git mv \ | |
$extra_test_lib \ | |
packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_map_inspector.dart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment