+++ /dev/null
-# appveyor.yml for editorconfig-vim. Currently only tests the core.
-# Modified from https://github.com/ppalaga/ec4j/commit/1c849658fb189cd95bc41af95acd43b4f0d75a48
-#
-# Copyright (c) 2017--2019 Angelo Zerr and other contributors as
-# indicated by the @author tags.
-#
-# 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.
-#
-# @author Chris White (cxw42) - Adapted to editorconfig-vim
-
-# === When to build ===
-# See https://www.appveyor.com/docs/how-to/filtering-commits/
-
-skip_commits:
- message: /\[minor\]/
- files:
- - '**/*.md'
-
-# === Build matrix ===
-
-# Win is default; Ubuntu is override. See
-# https://www.appveyor.com/blog/2018/04/25/specialized-build-matrix-configuration-in-appveyor/
-image:
- - Visual Studio 2013
- - Ubuntu1604
-
-# === How to build ===
-
-cache:
- - C:\vim -> .appveyor.yml, tests\fetch-vim.bat
-
-environment:
- VIM_EXE: C:\vim\vim\vim80\vim.exe
-
-for:
- # Don't run the Windows build if the commit message includes "[ci-linux]"
- -
- matrix:
- only:
- - image: Visual Studio 2013
- skip_commits:
- message: /\[ci-linux\]/
-
- # Platform-specific configuration for Ubuntu
- -
- matrix:
- only:
- - image: Ubuntu1604
- # $APPVEYOR_BUILD_FOLDER isn't expanded in the environment section
- # here, so I can't set $VIM_EXE the way I want to. Instead,
- # I set $VIM_EXE in the sh-specific install steps below.
- environment:
- VIM_EXE: UNDEFINED
- cache:
- - $APPVEYOR_BUILD_FOLDER/vim -> .appveyor.yml, tests/fetch-vim.sh
-
- # Plus, don't run Ubuntu if the commit message includes [ci-win]
- skip_commits:
- message: /\[ci-win\]/
-
-install:
- # Ubuntu-specific setup. These carry forward to the build_script.
- - sh: export VIM_EXE="$APPVEYOR_BUILD_FOLDER/vim/bin/vim"
- - sh: export PATH="$PATH":$APPVEYOR_BUILD_FOLDER/vim/bin
- - sh: echo "$VIM_EXE , $PATH"
-
- # Cross-platform - test the core
- - cmake --version
- - git submodule update --init --recursive
- - cmd: tests\fetch-vim
- - sh: tests/fetch-vim.sh
-
-build_script:
- # Build the core tests
- - cd tests
- - cd core
- - mkdir build
- - cd build
- - cmake ..
-
-# Note on multicore testing:
-# Two cores are available per https://help.appveyor.com/discussions/questions/11179-how-many-cores-and-threads-can-be-used-in-free-appveyor-build .
-# However, using -j2 seems to make each job take much longer.
-
-test_script:
- # Run the core tests
- - ctest . --output-on-failure -C Debug
-
- # CTestCustom specifies skipping some tests on Windows.
- - cmd: echo "Reminder - skipped some tests"
-
-on_failure:
- - echo "failed"
- - cmd: type tests\core\build\Testing\Temporary\LastTest.log
- - sh: cat tests/core/build/Testing/Temporary/LastTest.log
+++ /dev/null
-tags
-tests/**/build
-tests/**/.bundle
-
-# Editor backup files
-*.swp
-*~
-~*
+++ /dev/null
-[submodule "plugin_tests"]
- path = tests/plugin/spec/plugin_tests
- url = https://github.com/editorconfig/editorconfig-plugin-tests.git
-[submodule "core_tests"]
- path = tests/core/tests
- url = https://github.com/editorconfig/editorconfig-core-test.git
+++ /dev/null
-# Make sure xvfb works - https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-xvfb-directly
-dist: trusty
-
-matrix:
- include:
- - name: "plugin"
- env: TEST_WHICH=plugin
- language: ruby
- rvm:
- - 2.2.4
- gemfile: tests/plugin/Gemfile
- - name: "core"
- env: TEST_WHICH=core
-
-addons:
- apt:
- packages:
- - vim-gtk
-
-before_script:
- - "export DISPLAY=:99.0"
- - "sh -e /etc/init.d/xvfb start"
-
-script:
- ./tests/travis-test.sh
-
-notifications:
- email:
- on_success: change
- on_failure: always
-*editorconfig.txt*
+*editorconfig.txt* EditorConfig plugin for Vim
File: editorconfig.txt
Version: 1.1.1
--- /dev/null
+:EditorConfigReload editorconfig.txt /*:EditorConfigReload*
+EditorConfig#AddNewHook() editorconfig.txt /*EditorConfig#AddNewHook()*
+b:EditorConfig_disable editorconfig.txt /*b:EditorConfig_disable*
+editorconfig-advanced editorconfig.txt /*editorconfig-advanced*
+editorconfig-commands editorconfig.txt /*editorconfig-commands*
+editorconfig-contents editorconfig.txt /*editorconfig-contents*
+editorconfig-hook editorconfig.txt /*editorconfig-hook*
+editorconfig-installation editorconfig.txt /*editorconfig-installation*
+editorconfig-overview editorconfig.txt /*editorconfig-overview*
+editorconfig-settings editorconfig.txt /*editorconfig-settings*
+editorconfig.txt editorconfig.txt /*editorconfig.txt*
+g:EditorConfig_core_mode editorconfig.txt /*g:EditorConfig_core_mode*
+g:EditorConfig_enable_for_new_buf editorconfig.txt /*g:EditorConfig_enable_for_new_buf*
+g:EditorConfig_exclude_patterns editorconfig.txt /*g:EditorConfig_exclude_patterns*
+g:EditorConfig_exec_path editorconfig.txt /*g:EditorConfig_exec_path*
+g:EditorConfig_max_line_indicator editorconfig.txt /*g:EditorConfig_max_line_indicator*
+g:EditorConfig_preserve_formatoptions editorconfig.txt /*g:EditorConfig_preserve_formatoptions*
+g:EditorConfig_softtabstop_space editorconfig.txt /*g:EditorConfig_softtabstop_space*
+g:EditorConfig_softtabstop_tab editorconfig.txt /*g:EditorConfig_softtabstop_tab*
+g:EditorConfig_verbose editorconfig.txt /*g:EditorConfig_verbose*
+++ /dev/null
-# CMakeLists.txt for core testing in
-# editorconfig-core-vimscript and editorconfig-vim.
-
-# Copyright (c) 2011-2019 EditorConfig Team
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# To perform the test, from the root of the project tree, run
-# mkdir build
-# cd build
-# cmake ..
-# ctest .
-
-cmake_minimum_required(VERSION 3.5)
-#set(CMAKE_LEGACY_CYGWIN_WIN32 0)
-
-# Do not check any compiler
-project(editorconfig-core-vimscript NONE)
-
-enable_testing()
-
-# The test executable to use
-if(NOT WIN32)
- set(EDITORCONFIG_CMD "${CMAKE_SOURCE_DIR}/editorconfig")
-else()
- set(EDITORCONFIG_CMD "${CMAKE_SOURCE_DIR}/editorconfig.bat")
-endif()
-set(EDITORCONFIG_CMD_IS_TARGET FALSE)
-
-add_subdirectory(tests)
-
-# CTestCustom.cmake contains platform-specific test configuration.
-configure_file(CTestCustom.cmake ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
+++ /dev/null
-# CTestCustom.cmake: Skip UTF-8 tests
-# Part of editorconfig-vim
-
-# Copyright (c) 2011-2019 EditorConfig Team
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# Skip UTF8 tests on Windows for now per
-# https://github.com/editorconfig/editorconfig-core-c/pull/31#issue-154810185
-if(WIN32 AND (NOT "$ENV{RUN_UTF8}"))
- message(WARNING "Skipping UTF-8 tests on this platform")
- set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} g_utf_8_char)
- set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} utf_8_char)
-endif()
-
-# Skip min_supported_value_length on Windows since that test seems to
-# cause Appveyor to hang.
-if(WIN32)
- message(WARNING "Skipping min_supported_value_length test on this platform")
- set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} min_supported_value_length)
-endif()
+++ /dev/null
-' ecvbslib.vbs: VBScript routines for use in\r
-' editorconfig-core-vimscript and editorconfig-vim.\r
-' Copyright (c) 2018--2019 Chris White. All rights reserved.\r
-' Licensed CC-BY-SA, version 3.0 or any later version, at your option.\r
-\r
-' Remove CR and LF in a string\r
-function nocrlf(strin)\r
- nocrlf = Replace(Replace(strin, vbCr, ""), vbLf, "")\r
-end function\r
-\r
-' === Base64 ================================================================\r
-' from https://stackoverflow.com/a/40118072/2877364 by\r
-' https://stackoverflow.com/users/45375/mklement0\r
-\r
-' Base64-encodes the specified string.\r
-' Parameter fAsUtf16LE determines how the input text is encoded at the\r
-' byte level before Base64 encoding is applied.\r
-' * Pass False to use UTF-8 encoding.\r
-' * Pass True to use UTF-16 LE encoding.\r
-Function Base64Encode(ByVal sText, ByVal fAsUtf16LE)\r
-\r
- ' Use an aux. XML document with a Base64-encoded element.\r
- ' Assigning the byte stream (array) returned by StrToBytes() to .NodeTypedValue\r
- ' automatically performs Base64-encoding, whose result can then be accessed\r
- ' as the element's text.\r
- With CreateObject("Msxml2.DOMDocument").CreateElement("aux")\r
- .DataType = "bin.base64"\r
- if fAsUtf16LE then\r
- .NodeTypedValue = StrToBytes(sText, "utf-16le", 2)\r
- else\r
- .NodeTypedValue = StrToBytes(sText, "utf-8", 3)\r
- end if\r
- Base64Encode = nocrlf(.Text) ' No line breaks; MSXML adds them.\r
- End With\r
-\r
-End Function\r
-\r
-' Decodes the specified Base64-encoded string.\r
-' If the decoded string's original encoding was:\r
-' * UTF-8, pass False for fIsUtf16LE.\r
-' * UTF-16 LE, pass True for fIsUtf16LE.\r
-Function Base64Decode(ByVal sBase64EncodedText, ByVal fIsUtf16LE)\r
-\r
- Dim sTextEncoding\r
- if fIsUtf16LE Then sTextEncoding = "utf-16le" Else sTextEncoding = "utf-8"\r
-\r
- ' Use an aux. XML document with a Base64-encoded element.\r
- ' Assigning the encoded text to .Text makes the decoded byte array\r
- ' available via .nodeTypedValue, which we can pass to BytesToStr()\r
- With CreateObject("Msxml2.DOMDocument").CreateElement("aux")\r
- .DataType = "bin.base64"\r
- .Text = sBase64EncodedText\r
- Base64Decode = BytesToStr(.NodeTypedValue, sTextEncoding)\r
- End With\r
-\r
-End Function\r
-\r
-' Returns a binary representation (byte array) of the specified string in\r
-' the specified text encoding, such as "utf-8" or "utf-16le".\r
-' Pass the number of bytes that the encoding's BOM uses as iBomByteCount;\r
-' pass 0 to include the BOM in the output.\r
-function StrToBytes(ByVal sText, ByVal sTextEncoding, ByVal iBomByteCount)\r
-\r
- ' Create a text string with the specified encoding and then\r
- ' get its binary (byte array) representation.\r
- With CreateObject("ADODB.Stream")\r
- ' Create a stream with the specified text encoding...\r
- .Type = 2 ' adTypeText\r
- .Charset = sTextEncoding\r
- .Open\r
- .WriteText sText\r
- ' ... and convert it to a binary stream to get a byte-array\r
- ' representation.\r
- .Position = 0\r
- .Type = 1 ' adTypeBinary\r
- .Position = iBomByteCount ' skip the BOM\r
- StrToBytes = .Read\r
- .Close\r
- End With\r
-\r
-end function\r
-\r
-' Returns a string that corresponds to the specified byte array, interpreted\r
-' with the specified text encoding, such as "utf-8" or "utf-16le".\r
-function BytesToStr(ByVal byteArray, ByVal sTextEncoding)\r
-\r
- If LCase(sTextEncoding) = "utf-16le" then\r
- ' UTF-16 LE happens to be VBScript's internal encoding, so we can\r
- ' take a shortcut and use CStr() to directly convert the byte array\r
- ' to a string.\r
- BytesToStr = CStr(byteArray)\r
- Else ' Convert the specified text encoding to a VBScript string.\r
- ' Create a binary stream and copy the input byte array to it.\r
- With CreateObject("ADODB.Stream")\r
- .Type = 1 ' adTypeBinary\r
- .Open\r
- .Write byteArray\r
- ' Now change the type to text, set the encoding, and output the\r
- ' result as text.\r
- .Position = 0\r
- .Type = 2 ' adTypeText\r
- .CharSet = sTextEncoding\r
- BytesToStr = .ReadText\r
- .Close\r
- End With\r
- End If\r
-\r
-end function\r
-\r
-' === Runner ================================================================\r
-\r
-' Run a command, copy its stdout/stderr to ours, and return its exit\r
-' status.\r
-' Modified from https://stackoverflow.com/a/32493083/2877364 by\r
-' https://stackoverflow.com/users/3191599/nate-barbettini .\r
-' See also https://www.vbsedit.com/html/4c5b06ac-dc45-4ec2-aca1-f168bab75483.asp\r
-function RunCommandAndEcho(strCommand)\r
- Const WshRunning = 0\r
- Const WshFinished = 1\r
- Const WshFailed = 2\r
-\r
- Set WshShell = CreateObject("WScript.Shell")\r
- 'WScript.Echo "Running >>" & strCommand & "<<..."\r
- Set WshShellExec = WshShell.Exec(strCommand)\r
-\r
- Do While WshShellExec.Status = WshRunning\r
- 'WScript.Echo "Waiting..."\r
- WScript.Sleep 100\r
- Loop\r
-\r
- if not WshShellExec.StdOut.AtEndOfStream then\r
- WScript.StdOut.Write(WshShellExec.StdOut.ReadAll())\r
- end if\r
-\r
- if not WshShellExec.StdErr.AtEndOfStream then\r
- WScript.StdErr.Write(WshShellExec.StdErr.ReadAll())\r
- end if\r
-\r
- RunCommandAndEcho = WshShellExec.ExitCode\r
-end function\r
-\r
-' === Argument processing ===================================================\r
-\r
-function MakeY64Args(args)\r
-\r
- dim b64args(100) ' 100 = arbitrary max\r
-\r
- ' Make Y64-flavored base64 versions of each arg so we don't have to\r
- ' worry about quoting issues while executing PowerShell.\r
-\r
- idx=0\r
- For Each arg In args\r
- b64args(idx) = Base64Encode(nocrlf(arg), False)\r
- ' Y64 flavor of Base64\r
- b64args(idx) = replace( _\r
- replace( _\r
- replace(b64args(idx), "+", "."), _\r
- "/", "_" ), _\r
- "=", "-")\r
- 'Wscript.Echo cstr(idx) & ": >" & arg & "< = >" & b64args(idx) & "<"\r
- 'Wscript.Echo b64args(idx)\r
- idx = idx+1\r
- Next\r
-\r
- MakeY64Args = b64args\r
-end function\r
-\r
-Function QuoteForShell(strIn)\r
- QuoteForShell = """" & _\r
- replace(strIn, """", """""") & """"\r
-End Function\r
+++ /dev/null
-# ecvimlib.ps1: Editorconfig Vimscript core CLI, PowerShell version,\r
-# library routines.\r
-# Copyright (c) 2018--2019 Chris White. All rights reserved.\r
-# Licensed CC-BY-SA, version 3.0 or any later version, at your option.\r
-#\r
-# N.B.: debug output uses Warning only because those are displayed by default.\r
-\r
-#Requires -Version 3\r
-\r
-# Get the directory of this script. From\r
-# https://stackoverflow.com/a/5466355/2877364 by\r
-# https://stackoverflow.com/users/23283/jaredpar\r
-\r
-$global:DIR = $PSScriptRoot\r
-\r
-### Set up debugging output ============================================\r
-\r
-$global:debug=$env:EDITORCONFIG_DEBUG # Debug filename\r
-\r
-if($global:debug -and ($global:debug -notmatch '^/')) {\r
- # Relative to this script unless it starts with a slash. This is because\r
- # cwd is usually not $DIR when testing.\r
- $global:debug="${DIR}/${global:debug}"\r
-}\r
-\r
-### Process args =======================================================\r
-\r
-function de64_args($argv) {\r
- $argv | % {\r
- $b64 = $_ -replace '-','=' -replace '_','/' -replace '\.','+'\r
- [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($b64))\r
- }\r
-}\r
-\r
-### Helpers ============================================================\r
-\r
-# Append a string to $debug in UTF-8 rather than the default UTF-16\r
-filter global:D($file = $debug) {\r
- if($debug) {\r
- echo $_ | Out-File -FilePath $file -Encoding utf8 -Append\r
- }\r
-}\r
-\r
-# Escape a string for Vim\r
-function global:vesc($str) {\r
- return "'" + ($str -replace "'","''") + "'"\r
-}\r
-\r
-# Escape a string for a command-line argument.\r
-# See https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.arguments?view=netframework-4.7.2\r
-function global:argesc($arg) {\r
- return '"' + ($arg -replace '"','"""') + '"'\r
-}\r
-\r
-### Find the Vim EXE ===================================================\r
-\r
-function global:Find-Vim\r
-{\r
- if($env:VIM_EXE) {\r
- if($debug) { echo "Using env Vim $($env:VIM_EXE)" | D }\r
- return $env:VIM_EXE\r
- }\r
-\r
- $vims = @(get-childitem 'c:\program files*\vim\**\vim.exe' | `\r
- sort LastWriteTime -Descending) # @() => always array\r
-\r
- # write-host ($vims | format-table | out-string) # DEBUG\r
- # write-host ($vims | get-member | out-string)\r
- if($vims.count -gt 0) {\r
- if($debug) { echo "Using found Vim $($vims[0].FullName)" | D }\r
- return $vims[0].FullName\r
- }\r
-\r
- throw "Could not find vim.exe. Please set VIM_EXE to the path to your Vim."\r
-} #Find-Vim\r
-\r
-### Runner =============================================================\r
-\r
-# Run a process with the given arguments.\r
-function global:run_process\r
-{\r
- param(\r
- [Parameter(Mandatory=$true, Position=0)][string]$run,\r
- [string]$extrapath,\r
- [string]$stdout, # Redirect stdout to this file\r
- [string]$stderr, # Redirect stderr to this file\r
- [string[]]$argv # Arguments to $run\r
- )\r
- $si = new-object Diagnostics.ProcessStartInfo\r
- if($extrapath) {\r
- $si.EnvironmentVariables['path']+=";${extrapath}"\r
- }\r
- $si.FileName=$run\r
-\r
- # Stringify the arguments (blech)\r
- $argstr = $argv | % { (argesc $_) + ' ' }\r
- $si.Arguments = $argstr;\r
-\r
- if($debug) { echo "Running process $run with arguments >>$argstr<<" | D }\r
-\r
- $si.UseShellExecute=$false\r
- # DEBUG $si.RedirectStandardInput=$true\r
- if($stdout) {\r
- if($debug) { echo "Saving stdout to ${stdout}" | D }\r
- $si.RedirectStandardOutput=$true;\r
- }\r
- if($stderr) {\r
- if($debug) { echo "Saving stderr to ${stderr}" | D }\r
- $si.RedirectStandardError=$true;\r
- }\r
-\r
- $p = [Diagnostics.Process]::Start($si)\r
- # DEBUG $p.StandardInput.Close() # < /dev/null\r
-\r
- $p.WaitForExit()\r
- $retval = $p.ExitCode\r
-\r
- if($stdout) {\r
- echo "Standard output:" | D $stdout\r
- $p.StandardOutput.ReadToEnd() | `\r
- Out-File -FilePath $stdout -Encoding utf8 -Append\r
- }\r
-\r
- if($stderr) {\r
- echo "Standard error:" | D $stderr\r
- $p.StandardError.ReadToEnd() | `\r
- Out-File -FilePath $stderr -Encoding utf8 -Append\r
- }\r
-\r
- $p.Close()\r
-\r
- return $retval\r
-}\r
-\r
-if($debug) {\r
- echo "======================================================" | D\r
- Get-Date -format F | D\r
-}\r
-\r
-$global:VIM = Find-Vim\r
+++ /dev/null
-#!/bin/bash
-# editorconfig: Editorconfig Vimscript core CLI
-# Copyright (c) 2018--2019 Chris White. All rights reserved.
-# Licensed CC-BY-SA, version 3.0 or any later version, at your option.
-
-# Documentation {{{1
-helpstr=$(cat<<'EOF'
-editorconfig: command-line invoker for the Vimscript editorconfig core
-
-Normal usage:
- editorconfig [-f <config-file name>] [-b <version>]
- [-x <extra information>] <filenames...>
-
-The default <config-file name> is ".editorconfig".
-If -b is given, behave as <version>.
-If -x is given, the <extra information> is included in the debug-output file.
-
-Other options:
- editorconfig -h, --help Show this help
- editorconfig -v, --version Show version information
-
-Environment variables:
- VIM_EXE File/path of vim (default "vim")
- EDITORCONFIG_DEBUG File/path to which to append debug output
-
-EOF
-)
-
-# }}}1
-
-# Get the directory of this script into $this_script_dir. {{{1
-# From https://stackoverflow.com/a/246128/2877364 by
-# https://stackoverflow.com/users/407731 et al.
-
-this_script_dir=
-function get_dir()
-{
- local script_source_path="${BASH_SOURCE[0]}"
- while [ -h "$script_source_path" ]; do
- # resolve $script_source_path until the file is no longer a symlink
- this_script_dir="$( cd -P "$( dirname "$script_source_path" )" >/dev/null && pwd )"
- script_source_path="$(readlink "$script_source_path")"
- [[ $script_source_path != /* ]] && script_source_path="$this_script_dir/$script_source_path"
- # if $script_source_path was a relative symlink, we need to resolve
- # it relative to the path where the symlink file was located
- done
- this_script_dir="$( cd -P "$( dirname "$script_source_path" )" >/dev/null && pwd )"
-} #get_dir()
-
-get_dir
-
-# }}}1
-
-# Setup debug output, if $EDITORCONFIG_DEBUG is given {{{1
-debug="${EDITORCONFIG_DEBUG}" # Debug filename
-if [[ $debug && $debug != /* ]]; then # Relative to this script unless it
- debug="${this_script_dir}/${debug}" # starts with a slash. This is because
-fi # cwd is usually not $this_script_dir when testing.
-if [[ $debug ]] && ! touch "$debug"; then
- echo "Could not write file '$debug' - aborting" 1>&2
- exit 1
-fi
-
-[[ $debug ]] && echo "$(date) ==================================" >> "$debug"
-
-# }}}1
-
-# Option processing {{{1
-
-# Use a manually-specified Vim, if any
-if [[ $VIM_EXE ]]; then
- vim_pgm="$VIM_EXE"
-else
- vim_pgm="vim"
-fi
-
-# Command-line options
-confname=
-ver=
-print_ver=
-extra_info=
-
-while getopts 'hvf:b:-:x:' opt ; do
- case "$opt" in
- (v) print_ver=1
- ;;
-
- (f) confname="$OPTARG"
- ;;
-
- (b) ver="$OPTARG"
- ;;
-
- (-) case "$OPTARG" in # hacky long-option processing
- version) print_ver=1
- ;;
- dummy) # A dummy option so that I can test
- # list-valued EDITORCONFIG_CMD
- ;;
- help) echo "$helpstr"
- exit 0
- ;;
- esac
- ;;
-
- (h) echo "$helpstr"
- exit 0
- ;;
-
- # A way to put the test name into the log
- (x) extra_info="$OPTARG"
- ;;
-
- esac
-done
-
-shift $(( $OPTIND - 1 ))
-
-if [[ $print_ver ]]; then
- echo "EditorConfig VimScript Core Version 0.12.2"
- exit 0
-fi
-
-if (( "$#" < 1 )); then
- exit 1
-fi
-
-if [[ $1 = '-' ]]; then
- echo "Reading filenames from stdin not yet supported" 1>&2 # TODO
- exit 1
-fi
-
-# }}}1
-
-# Build the Vim command line {{{1
-
-fn="$(mktemp)" # Vim will write the settings into here. ~stdout.
-script_output_fn="${debug:+$(mktemp)}" # Vim's :messages. ~stderr.
-
-cmd="call editorconfig_core#currbuf_cli({"
-
-# Names
-cmd+="'output':'${fn//\'/\'\'}', "
- # filename to put the settings in
-[[ $debug ]] && cmd+=" 'dump':'${script_output_fn//\'/\'\'}', "
- # where to put debug info
-
-# Filenames to get the settings for
-cmd+="'target':["
-for f in "$@" ; do
- cmd+="'${f//\'/\'\'}', "
-done
-cmd+="],"
- # filename to get the settings for
-
-# Job
-cmd+="}, {"
-[[ $confname ]] && cmd+="'config':'${confname//\'/\'\'}', "
- # config name (e.g., .editorconfig)
-[[ $ver ]] && cmd+="'version':'${ver//\'/\'\'}', "
- # version number we should behave as
-cmd+="})"
-
-vim_args=(
- -c "set runtimepath+=$this_script_dir/../.."
- -c "$cmd"
-)
-
-# }}}1
-
-# Run the editorconfig core through Vim {{{1
-# Thanks for options to
-# http://vim.wikia.com/wiki/Vim_as_a_system_interpreter_for_vimscript .
-# Add -V1 to the below for debugging output.
-# Do not output anything to stdout or stderr,
-# since it messes up ctest's interpretation
-# of the results.
-
-"$vim_pgm" -nNes -i NONE -u NONE -U NONE \
- "${vim_args[@]}" \
- </dev/null &>> "${debug:-/dev/null}"
-vimstatus="$?"
-if [[ $vimstatus -eq 0 ]]; then
- cat "$fn"
-fi
-
-# }}}1
-
-# Produce debug output {{{1
-# Debug output cannot be included on stdout or stderr, because
-# ctest's regex check looks both of those places. Therefore, dump to a
-# separate debugging file.
-if [[ $debug ]]
-then
- [[ $extra_info ]] && echo "--- $extra_info ---" >> "$debug"
- echo "Vim in $vim_pgm" >> "$debug"
- echo "Current directory: $(pwd)" >> "$debug"
- echo "Script directory: $this_script_dir" >> "$debug"
- echo Vim args: "${vim_args[@]}" >> "$debug"
- #od -c <<<"${vim_args[@]}" >> "$debug"
- echo "Vim returned $vimstatus" >> "$debug"
- echo "Vim messages were: " >> "$debug"
- cat "$script_output_fn" >> "$debug"
- echo "Output was:" >> "$debug"
- od -c "$fn" >> "$debug"
-
- rm -f "$script_output_fn"
-fi
-
-# }}}1
-
-# Cleanup {{{1
-
-rm -f "$fn"
-
-# }}}1
-
-exit "$vimstatus" # forward the Vim exit status to the caller
-# vi: set ft=sh fdm=marker:
+++ /dev/null
-@echo off\r
-:: editorconfig.bat: First-level invoker for editorconfig-core-vimscript\r
-:: and editorconfig-vim.\r
-:: Just passes the full command line to editorconfig1.vbs, since VBScript\r
-:: applies very simple quoting rules when it parses a command line.\r
-:: Copyright (c) 2018--2019 Chris White. All rights reserved.\r
-:: Licensed CC-BY-SA, version 3.0 or any later version, at your option.\r
-set here=%~dp0\r
-\r
-cscript //Nologo "%here%editorconfig1.vbs" %*\r
-:: %* has the whole command line\r
+++ /dev/null
-' editorconfig1.vbs: run by editorconfig.bat\r
-' runs editorconfig2.ps1\r
-' Part of editorconfig-core-vimscript and editorconfig-vim.\r
-'\r
-' Copyright (c) 2018--2019 Chris White. All rights reserved.\r
-' Licensed CC-BY-SA, version 3.0 or any later version, at your option.\r
-'\r
-' Modified from\r
-' https://stackoverflow.com/a/2470557/2877364 by\r
-' https://stackoverflow.com/users/2441/aphoria\r
-\r
-' Thanks to https://www.geekshangout.com/vbs-script-to-get-the-location-of-the-current-script/\r
-currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")\r
-\r
-' Load our common library. Thanks to https://stackoverflow.com/a/316169/2877364\r
-With CreateObject("Scripting.FileSystemObject")\r
- executeGlobal .openTextFile(currentScriptPath & "ecvbslib.vbs").readAll()\r
-End With\r
-\r
-' === MAIN ==================================================================\r
-\r
-' Encode all the arguments as modified base64 so there will be no quoting\r
-' issues when we invoke powershell.\r
-b64args = MakeY64Args(Wscript.Arguments)\r
-\r
-' Quote script name just in case\r
-ps1name = QuoteForShell(currentScriptPath & "editorconfig2.ps1")\r
-'Wscript.Echo "Script is in " & ps1name\r
-\r
-if True then\r
- retval = RunCommandAndEcho( "powershell.exe" & _\r
- " -executionpolicy bypass -file " & ps1name & " " & join(b64args) _\r
- )\r
- ' add -noexit to leave window open so you can see error messages\r
-\r
- WScript.Quit retval\r
-end if\r
-\r
-' vi: set ts=4 sts=4 sw=4 et ai:\r
+++ /dev/null
-# editorconfig2.ps1: Editorconfig Vimscript core CLI, PowerShell version\r
-# Copyright (c) 2018--2019 Chris White. All rights reserved.\r
-# Licensed CC-BY-SA, version 3.0 or any later version, at your option.\r
-# Thanks to https://cecs.wright.edu/~pmateti/Courses/233/Labs/Scripting/bashVsPowerShellTable.html\r
-# by Gallagher and Mateti.\r
-\r
-#Requires -Version 3\r
-\r
-. "$PSScriptRoot\ecvimlib.ps1"\r
-\r
-# Argument parsing =================================================== {{{1\r
-\r
-$argv = @(de64_args($args))\r
-\r
-# Defaults\r
-$report_version = $false\r
-$set_version = ''\r
-$config_name = '.editorconfig'\r
-$extra_info = ''\r
-$files=@()\r
-\r
-# Hand-parse - pretend we're sort of like getopt.\r
-$idx = 0\r
-while($idx -lt $argv.count) {\r
- $a = $argv[$idx]\r
-\r
- switch -CaseSensitive -Regex ($a) {\r
- '^(-v|--version)$' { $report_version = $true }\r
-\r
- '^--dummy$' {\r
- # A dummy option so that I can test list-valued EDITORCONFIG_CMD\r
- }\r
-\r
- '^-f$' {\r
- if($idx -eq ($argv.count-1)) {\r
- throw '-f <filename>: no filename provided'\r
- } else {\r
- ++$idx\r
- $config_name = $argv[$idx]\r
- }\r
- } #-f\r
-\r
- '^-b$' {\r
- if($idx -eq ($argv.count-1)) {\r
- throw '-b <version>: no version provided'\r
- } else {\r
- ++$idx\r
- $set_version = $argv[$idx]\r
- }\r
- } #-b\r
-\r
- '^-x$' {\r
- if($idx -eq ($argv.count-1)) {\r
- throw '-x <extra info>: no info provided'\r
- } else {\r
- ++$idx\r
- $extra_info = $argv[$idx]\r
- }\r
- } #-x\r
-\r
- '^--$' { # End of options, so capture the rest as filenames\r
- ++$idx;\r
- while($idx -lt $argv.count) {\r
- $files += $argv[$idx]\r
- }\r
- }\r
-\r
- default { $files += $a }\r
- }\r
-\r
- ++$idx\r
-} # end foreach argument\r
-\r
-# }}}1\r
-# Argument processing ================================================ {{{1\r
-\r
-if($debug) {\r
- if($extra_info -ne '') {\r
- echo "--- $extra_info --- " | D\r
- }\r
-\r
- echo "Running in $DIR" | D\r
- echo "Vim executable: $VIM" | D\r
- echo "report version? $report_version" | D\r
- echo "set version to: $set_version" | D\r
- echo "config filename: $config_name" | D\r
- echo "Filenames: $files" | D\r
- echo "Args: $args" | D\r
- echo "Decoded args: $argv" | D\r
-}\r
-\r
-if($report_version) {\r
- echo "EditorConfig VimScript Core Version 0.12.2"\r
- exit\r
-}\r
-\r
-if($files.count -lt 1) {\r
- exit\r
-}\r
-\r
-if($files[0] -eq '-') {\r
- echo "Reading filenames from stdin not yet supported" # TODO\r
- exit 1\r
-}\r
-\r
-$fn=[System.IO.Path]::GetTempFileName();\r
- # Vim will write the settings into here. Sort of like stdout.\r
-$script_output_fn = ''\r
-if($debug) {\r
- $script_output_fn = [System.IO.Path]::GetTempFileName()\r
-}\r
-\r
-# Permit throwing in setup commands\r
-$cmd = ''\r
-if($env:EDITORCONFIG_EXTRA) {\r
- $cmd += $env:EDITORCONFIG_EXTRA + ' | '\r
-}\r
-\r
-# }}}1\r
-# Build Vim command line ============================================= {{{1\r
-$cmd += 'call editorconfig_core#currbuf_cli({'\r
-\r
-# Names\r
-$cmd += "'output':" + (vesc($fn)) + ", "\r
- # filename to put the settings in\r
-if($debug) {\r
- $cmd += " 'dump':" + (vesc($script_output_fn)) + ", "\r
- # where to put debug info\r
-}\r
-\r
-# Filenames to get the settings for\r
-$cmd += "'target':["\r
-ForEach ($item in $files) {\r
- $cmd += (vesc($item)) + ", "\r
-}\r
-$cmd += "],"\r
-\r
-# Job\r
-$cmd += "}, {"\r
-if($config_name) { $cmd += "'config':" + (vesc($config_name)) + ", " }\r
- # config name (e.g., .editorconfig)\r
-if($set_version) { $cmd += "'version':" + (vesc($set_version)) + ", " }\r
- # version number we should behave as\r
-$cmd += "})"\r
-\r
-#$cmd =':q!' # DEBUG\r
-if($debug) { echo "Using Vim command ${cmd}" | D }\r
-$vim_args = @(\r
- '-c', "set runtimepath+=${DIR}\..\..",\r
- '-c', $cmd,\r
- '-c', 'quit!' # TODO write a wrapper that will cquit on exception\r
-)\r
-\r
-# Run editorconfig. Thanks for options to\r
-# http://vim.wikia.com/wiki/Vim_as_a_system_interpreter_for_vimscript .\r
-# Add -V1 to the below for debugging output.\r
-# Do not output anything to stdout or stderr,\r
-# since it messes up ctest's interpretation\r
-# of the results.\r
-\r
-$basic_args = '-nNes','-i','NONE','-u','NONE','-U','NONE' #, '-V1'\r
-\r
-# }}}1\r
-# Run Vim ============================================================ {{{1\r
-\r
-if($debug) { echo "Running vim ${VIM}" | D }\r
-$vimstatus = run_process $VIM -stdout $debug -stderr $debug `\r
- -argv ($basic_args+$vim_args)\r
-if($debug) { echo "Done running vim" | D }\r
-\r
-if($vimstatus -eq 0) {\r
- cat $fn\r
-}\r
-\r
-# }}}1\r
-# Produce debug output =============================================== {{{1\r
-\r
-# Debug output cannot be included on stdout or stderr, because\r
-# ctest's regex check looks both of those places. Therefore, dump to a\r
-# separate debugging file.\r
-\r
-if($debug) {\r
- echo "Current directory:" | D\r
- (get-item -path '.').FullName | D\r
- echo "Script directory: $DIR" | D\r
-### echo Vim args: "${vim_args[@]}" >> "$debug"\r
-### #od -c <<<"${vim_args[@]}" >> "$debug"\r
- echo "Vim returned $vimstatus" | D\r
- echo "Vim messages were: " | D\r
- cat $script_output_fn | D\r
- echo "Output was:" | D\r
-\r
- # Modified from https://www.itprotoday.com/powershell/get-hex-dumps-files-powershell\r
- Get-Content $script_output_fn -Encoding Byte -ReadCount 16 | `\r
- ForEach-Object {\r
- $output = ""\r
- $chars = ''\r
- foreach ( $byte in $_ ) {\r
- $output += "{0:X2} " -f $byte\r
- if( ($byte -ge 32) -and ($byte -le 127) ) {\r
- $chars += [char]$byte\r
- } else {\r
- $chars += '.'\r
- }\r
- }\r
- $output + ' ' + $chars\r
- } | D\r
-\r
- del -Force $script_output_fn\r
-} #endif $debug\r
-\r
-# }}}1\r
-\r
-del -Force $fn\r
-\r
-exit $vimstatus\r
-\r
-# vi: set fdm=marker:\r
+++ /dev/null
-:: fetch-vim.bat: Fetch vim if necessary
-:: For use in the editorconfig-vim Appveyor build
-:: Copyright (c) 2018--2019 Chris White. All rights reserved.
-:: Licensed Apache 2.0, or any later version, at your option.
-
-:: If it's already been loaded from the cache, we're done
-if exist C:\vim\vim\vim80\vim.exe exit
-
-:: Otherwise, download and unzip it.
-appveyor DownloadFile https://github.com/cxw42/editorconfig-core-vimscript/releases/download/v0.1.0/vim.7z
-
-7z x vim.7z -oC:\vim
+++ /dev/null
-#!/bin/bash
-# fetch-vim.bat: Fetch vim if necessary
-# For use in the editorconfig-vim Appveyor build
-# Copyright (c) 2018--2019 Chris White. All rights reserved.
-# Licensed Apache 2.0, or any later version, at your option.
-
-# Debugging
-set -x
-set -o nounset
-#set -o errexit
-
-# Basic system info
-uname -a
-pwd
-ls -l
-
-echo "VIM_EXE: $VIM_EXE"
-set
-
-# If it's already been loaded from the cache, we're done
-if [[ -x "$VIM_EXE" ]]; then
- echo Vim found in cache at "$VIM_EXE"
- exit 0
-fi
-
-# Otherwise, clone and build it
-WHITHER="$APPVEYOR_BUILD_FOLDER/vim"
-
-git clone https://github.com/vim/vim-appimage.git
-cd vim-appimage
-git submodule update --init --recursive
-
-cd vim/src
-./configure --with-features=huge --prefix="$WHITHER" --enable-fail-if-missing
-make -j2 # Free tier provides two cores
-make install
-./vim --version
-cd $APPVEYOR_BUILD_FOLDER
-find . -type f -name vim -exec ls -l {} +
-
-echo Done fetching and installing vim
+++ /dev/null
-# Where bundler installs local Gemfile dependencies
-/vendor/
+++ /dev/null
-source 'https://rubygems.org'
-
-gem 'rake', '~> 12.3.3'
-gem 'rspec', '~> 3.4.0'
-gem 'vimrunner', '~> 0.3.1'
+++ /dev/null
-GEM
- remote: https://rubygems.org/
- specs:
- diff-lcs (1.2.5)
- rake (12.3.3)
- rspec (3.4.0)
- rspec-core (~> 3.4.0)
- rspec-expectations (~> 3.4.0)
- rspec-mocks (~> 3.4.0)
- rspec-core (3.4.1)
- rspec-support (~> 3.4.0)
- rspec-expectations (3.4.0)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.4.0)
- rspec-mocks (3.4.0)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.4.0)
- rspec-support (3.4.1)
- vimrunner (0.3.1)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- rake (~> 12.3.3)
- rspec (~> 3.4.0)
- vimrunner (~> 0.3.1)
+++ /dev/null
-#
-# run `rake` to run tests
-
-require 'rspec/core/rake_task'
-
-RSpec::Core::RakeTask.new(:spec)
-
-task :default => :spec
+++ /dev/null
-[*.rb]
-indent_style = space
-indent_size = 2
-end_of_line = lf
+++ /dev/null
-require 'vimrunner'
-
-def create_vim(*initial_commands)
- vim = Vimrunner.start
- initial_commands.each do |cmd|
- vim.command cmd
- end
- vim.add_plugin(File.expand_path('../../../..', __FILE__), 'plugin/editorconfig.vim')
- return vim
-end
-
-# The base path of the testing files
-BASE_PATH = File.expand_path('../plugin_tests/test_files/', __FILE__)
-
-# file_name is the file name that should be open by Vim
-# expected_values is a Hash that contains all the Vim options we need to test
-def test_editorconfig(vim, file_name, expected_values)
- vim.edit(File.join(BASE_PATH, file_name))
-
- expected_values.each do |key, val|
- vimval = vim.echo("&l:#{key}")
- expect(vimval).to eq(val), "key #{key} had value #{vimval}, but I expected #{val}"
- end
-
- vim.command 'bd!'
-end
-
-def test_instance(vim)
- describe 'plugin/editorconfig.vim' do
- after(:all) do
- vim.kill
- end
-
- describe '#all' do
- it '3_space.py' do
- test_editorconfig vim, '3_space.txt',
- expandtab: '1',
- shiftwidth: '3',
- tabstop: '3'
- end
- end
-
- it '4_space.py' do
- test_editorconfig vim, '4_space.py',
- expandtab: '1',
- shiftwidth: '4',
- tabstop: '8'
- end
-
- it 'space.txt' do
- test_editorconfig vim, 'space.txt',
- expandtab: '1',
- shiftwidth: vim.echo('&l:tabstop')
- end
-
- it 'tab.txt' do
- test_editorconfig vim, 'tab.txt',
- expandtab: '0'
- end
-
- it '4_tab.txt' do
- test_editorconfig vim, '4_tab.txt',
- expandtab: '0',
- shiftwidth: '4',
- tabstop: '4'
- end
-
- it '4_tab_width_of_8' do
- test_editorconfig vim, '4_tab_width_of_8.txt',
- expandtab: '0',
- shiftwidth: '4',
- tabstop: '8'
- end
-
- it 'lf.txt' do
- test_editorconfig vim, 'lf.txt',
- fileformat: 'unix'
- end
-
- it 'crlf.txt' do
- test_editorconfig vim, 'crlf.txt',
- fileformat: 'dos'
- end
-
- it 'cr.txt' do
- test_editorconfig vim, 'cr.txt',
- fileformat: 'mac'
- end
-
- it 'utf-8.txt' do
- test_editorconfig vim, 'utf-8.txt',
- fileencoding: 'utf-8',
- bomb: '0'
- end
-
- it 'utf-8-bom.txt' do
- test_editorconfig vim, 'utf-8-bom.txt',
- fileencoding: 'utf-8',
- bomb: '1'
- end
-
- it 'utf-16be.txt' do
- test_editorconfig vim, 'utf-16be.txt',
- fileencoding: 'utf-16'
- end
-
- it 'utf-16le.txt' do
- test_editorconfig vim, 'utf-16le.txt',
- fileencoding: 'utf-16le'
- end
-
- it 'latin1.txt' do
- test_editorconfig vim, 'latin1.txt',
- fileencoding: 'latin1'
- end
-
- # insert_final_newline by PreserveNoEOL tests are omitted, since they are not supported
- if vim.echo("exists('+fixendofline')") == '1'
- it 'with_newline.txt' do
- test_editorconfig vim, 'with_newline.txt',
- fixendofline: '1'
- end
-
- it 'without_newline.txt' do
- test_editorconfig vim, 'without_newline.txt',
- fixendofline: '0'
- end
- end
- end
-end
-
-# Test the vim core
-(lambda do
- puts 'Testing default'
- vim = create_vim
- test_instance vim
-end).call
-
-# Test the vim core with an express setting
-(lambda do
- puts 'Testing with express vim_core mode'
- vim = create_vim("let g:EditorConfig_core_mode='vim_core'")
- test_instance vim
-end).call
-
-# Test with external-core mode, but no external core defined
-(lambda do
- puts 'Testing with fallback to vim_core mode'
- vim = create_vim("let g:EditorConfig_core_mode='external_command'")
- test_instance vim
-end).call
-
-# Test with an external core, if desired
-extcore = ENV['EDITORCONFIG_VIM_EXTERNAL_CORE']
-if extcore
- puts "Testing with external_command #{extcore}"
- vim = create_vim(
- "let g:EditorConfig_core_mode='external_command'",
- "let g:EditorConfig_exec_path='#{extcore}'",
- )
- test_instance vim
-end
-
-# Test the vim core with latin1 encoding
-(lambda do
- puts 'Testing with express vim_core mode'
- vim = create_vim("set encoding=latin1")
- test_instance vim
-end).call
+++ /dev/null
-#!/bin/bash
-# travis-test.sh: Script for running editorconfig-vim tests under Travis CI.
-# Copyright (c) 2019 Chris White. All rights reserved.
-# Licensed Apache, version 2.0 or any later version, at your option.
-
-# Error exit; debug output
-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:-}" ]]; then
- cat <<EOT
-Usage: $0 \$WHICH
- or: TEST_WHICH=\$WHICH $0
-Run automated tests of editorconfig-vim
-
-\$WHICH can be "core" or "plugin".
-EOT
- exit 2
-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
-
- # 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
-
-elif [[ "$TEST_WHICH" = 'core' ]]; then # test core
- cd tests/core
- 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