blob: 4d2387ab64d6e1f8b7d39e4ab164fcbb8572c47d [file] [log] [blame]
# Copyright 2016 Dart Mockito authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
# Make sure dartfmt is run on everything
# This assumes you have dart_style as a dev_dependency
echo "Checking dartfmt..."
NEEDS_DARTFMT="$(find lib test -name "*.dart" | xargs dartfmt -n)"
if [[ ${NEEDS_DARTFMT} != "" ]]
then
echo "FAILED"
echo "${NEEDS_DARTFMT}"
exit 1
fi
echo "PASSED"
# Make sure we pass the analyzer
echo "Checking dartanalyzer..."
FAILS_ANALYZER="$(find lib test -name "*.dart" | xargs dartanalyzer --options .analysis_options)"
if [[ $FAILS_ANALYZER == *"[error]"* ]]
then
echo "FAILED"
echo "${FAILS_ANALYZER}"
exit 1
fi
echo "PASSED"
# Fail on anything that fails going forward.
set -e
pub run test