Skip to content

Commit

Permalink
Merge pull request #140 from cxw42/test-from-cmdline
Browse files Browse the repository at this point in the history
Can use tests/travis-test.sh to test plugin from command line
  • Loading branch information
cxw42 authored May 26, 2020
2 parents 8aff78a + 60b0655 commit 0818c7e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
tags
tests/**/build
tests/**/.bundle

# Editor backup files
*.swp
*~
~*
2 changes: 2 additions & 0 deletions tests/plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Where bundler installs local Gemfile dependencies
/vendor/
29 changes: 25 additions & 4 deletions tests/travis-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,42 @@
# Licensed Apache, version 2.0 or any later version, at your option.

# Error exit; debug output
set -evx
set -vxEeuo pipefail

# Permit `travis-test.sh plugin` if TEST_WHICH is unset
if [[ ( ! "${TEST_WHICH:-}" ) && "${1:-}" ]]; then
export TEST_WHICH="$1"
fi

if [[ "$TEST_WHICH" = 'plugin' ]]; then # test plugin

# If not running from Travis, do what Travis would have
# done for us.
if [[ ! "${BUNDLE_GEMFILE:-}" ]]; then
here="$(cd "$(dirname "$0")" &>/dev/null ; pwd)"
export BUNDLE_GEMFILE="${here}/plugin/Gemfile"
# Install into tests/plugin/vendor. Don't clear it first,
# since you can clear it yourself if you're running from a
# dev environment.
bundle install --jobs=3 --retry=3 --deployment
fi

if [[ $TEST_WHICH = 'plugin' ]]; then # test plugin
# Use the standalone Vimscript EditorConfig core to test the plugin's
# external_command mode
export EDITORCONFIG_VIM_EXTERNAL_CORE=tests/core/editorconfig

bundle exec rspec tests/plugin/spec/editorconfig_spec.rb

else # test core
elif [[ "$TEST_WHICH" = 'core' ]]; then # test core
cd tests/core
mkdir build
mkdir -p build # May already exist if running from a dev env
cd build
cmake ..
ctest . --output-on-failure -VV -C Debug
# -C Debug: for Visual Studio builds, you have to specify
# a configuration.

else
echo 'Invalid TEST_WHICH value' 1>&2
exit 1
fi

0 comments on commit 0818c7e

Please sign in to comment.