mirror of
https://github.com/sharkdp/bat
synced 2024-11-23 20:33:06 +00:00
Add Batch syntax test
This commit is contained in:
parent
9257c7ce20
commit
09631ed119
3 changed files with 144 additions and 0 deletions
59
tests/syntax-tests/highlighted/Batch/build.bat
Normal file
59
tests/syntax-tests/highlighted/Batch/build.bat
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
[38;2;249;38;114m@[0m[38;2;249;38;114mecho[0m[38;2;248;248;242m off[0m
|
||||||
|
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Change to your LLVM installation[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mLLVMPath[0m[38;2;249;38;114m=[0m[38;2;230;219;116mC:\Program Files\LLVM[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Change to your Visual Studio 2017 installation[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mVSPath[0m[38;2;249;38;114m=[0m[38;2;230;219;116mC:\Program Files [0m[38;2;230;219;116m([0m[38;2;230;219;116mx86[0m[38;2;230;219;116m)[0m[38;2;230;219;116m\Microsoft Visual Studio\[0m[38;2;190;132;255m2017[0m[38;2;230;219;116m\Community[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mVSVersion[0m[38;2;249;38;114m=[0m[38;2;190;132;255m14[0m[38;2;230;219;116m.[0m[38;2;190;132;255m10[0m[38;2;230;219;116m.[0m[38;2;190;132;255m25017[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Change to your Windows Kit version & installation[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;249;38;114m=[0m[38;2;190;132;255m10[0m[38;2;230;219;116m.[0m[38;2;190;132;255m0[0m[38;2;230;219;116m.[0m[38;2;190;132;255m15063[0m[38;2;230;219;116m.[0m[38;2;190;132;255m0[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mWinSDKPath[0m[38;2;249;38;114m=[0m[38;2;230;219;116mC:\Program Files [0m[38;2;230;219;116m([0m[38;2;230;219;116mx86[0m[38;2;230;219;116m)[0m[38;2;230;219;116m\Windows Kits\[0m[38;2;190;132;255m10[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Change this to your resulting exe[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mOUTPUT[0m[38;2;249;38;114m=[0m[38;2;230;219;116mtest.exe[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Setup[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mVSBasePath[0m[38;2;249;38;114m=[0m[38;2;255;255;255m%[0m[38;2;255;255;255mVSPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\VC\Tools\MSVC\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mVSVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mPATH[0m[38;2;249;38;114m=[0m[38;2;255;255;255m%[0m[38;2;255;255;255mPATH[0m[38;2;255;255;255m%[0m[38;2;230;219;116m;[0m[38;2;255;255;255m%[0m[38;2;255;255;255mLLVMPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\bin;[0m[38;2;255;255;255m%[0m[38;2;255;255;255mVSBasePath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\bin\HostX64\x64[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Compiler Flags[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;255;255;255mCFLAGS[0m[38;2;249;38;114m=[0m[38;2;230;219;116m ^[0m
|
||||||
|
[38;2;248;248;242m -std=c++[0m[38;2;190;132;255m14[0m[38;2;248;248;242m -Wall -Wextra[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;255;255;255mCPPFLAGS[0m[38;2;249;38;114m=[0m[38;2;230;219;116m ^[0m
|
||||||
|
[38;2;248;248;242m -I [0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mVSBasePath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\include[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -I [0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\Include\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\shared[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -I [0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\Include\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\ucrt[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -I [0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\Include\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\um[0m[38;2;230;219;116m"[0m
|
||||||
|
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Linker Libs[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;255;255;255mLDFLAGS[0m[38;2;249;38;114m=[0m[38;2;230;219;116m ^[0m
|
||||||
|
[38;2;248;248;242m -machine:x64 [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -nodefaultlib [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -subsystem:console[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;255;255;255mLDLIBS[0m[38;2;249;38;114m=[0m[38;2;230;219;116m ^[0m
|
||||||
|
[38;2;248;248;242m -libpath:[0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mVSBasePath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\lib\x64[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -libpath:[0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\Lib\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\ucrt\x64[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m -libpath:[0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKPath[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\Lib\[0m[38;2;255;255;255m%[0m[38;2;255;255;255mWinSDKVersion[0m[38;2;255;255;255m%[0m[38;2;230;219;116m\um\x64[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m libucrt.lib libvcruntime.lib libcmt.lib libcpmt.lib [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m legacy_stdio_definitions.lib oldnames.lib [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m legacy_stdio_wide_specifiers.lib [0m[38;2;190;132;255m^[0m
|
||||||
|
[38;2;248;248;242m kernel32.lib User32.lib[0m
|
||||||
|
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Compiling[0m
|
||||||
|
[38;2;249;38;114m@[0m[38;2;249;38;114mecho[0m[38;2;248;248;242m on[0m
|
||||||
|
[38;2;249;38;114m@[0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255m%%[0m[38;2;248;248;242mf in [0m[38;2;248;248;242m([0m[38;2;248;248;242m*.cc[0m[38;2;248;248;242m)[0m[38;2;248;248;242m do [0m[38;2;248;248;242m([0m
|
||||||
|
[38;2;248;248;242m clang++.exe [0m[38;2;230;219;116m"[0m[38;2;190;132;255m%%[0m[38;2;230;219;116m~f[0m[38;2;230;219;116m"[0m[38;2;248;248;242m -o [0m[38;2;230;219;116m"[0m[38;2;190;132;255m%%[0m[38;2;230;219;116m~nf.o[0m[38;2;230;219;116m"[0m[38;2;248;248;242m -c [0m[38;2;255;255;255m%[0m[38;2;255;255;255mCFLAGS[0m[38;2;255;255;255m%[0m
|
||||||
|
[38;2;248;248;242m)[0m
|
||||||
|
|
||||||
|
[38;2;117;113;94m::[0m[38;2;117;113;94m Linking[0m
|
||||||
|
[38;2;249;38;114m@[0m[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mLINK_FILES[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114m@[0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255m%%[0m[38;2;248;248;242mf in [0m[38;2;248;248;242m([0m[38;2;248;248;242m*.o[0m[38;2;248;248;242m)[0m[38;2;248;248;242m do [0m[38;2;248;248;242m([0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;249;38;114mset[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;255;255;255mLINK_FILES[0m[38;2;249;38;114m=[0m[38;2;255;255;255m%[0m[38;2;255;255;255mLINK_FILES[0m[38;2;255;255;255m%[0m[38;2;230;219;116m [0m[38;2;190;132;255m%%[0m[38;2;230;219;116m~f[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242m)[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242mlld-link.exe [0m[38;2;255;255;255m%[0m[38;2;255;255;255mLINK_FILES[0m[38;2;255;255;255m%[0m[38;2;248;248;242m -out:[0m[38;2;230;219;116m"[0m[38;2;255;255;255m%[0m[38;2;255;255;255mOUTPUT[0m[38;2;255;255;255m%[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;255;255;255m%[0m[38;2;255;255;255mLDFLAGS[0m[38;2;255;255;255m%[0m[38;2;248;248;242m [0m[38;2;255;255;255m%[0m[38;2;255;255;255mLDLIBS[0m[38;2;255;255;255m%[0m
|
26
tests/syntax-tests/source/Batch/LICENSE.md
Normal file
26
tests/syntax-tests/source/Batch/LICENSE.md
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
The `build.bat` file has been added from https://github.com/Leandros/ClangOnWindows/blob/master/build.bat under the following license:
|
||||||
|
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org>
|
59
tests/syntax-tests/source/Batch/build.bat
Normal file
59
tests/syntax-tests/source/Batch/build.bat
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
|
||||||
|
:: Change to your LLVM installation
|
||||||
|
set "LLVMPath=C:\Program Files\LLVM"
|
||||||
|
:: Change to your Visual Studio 2017 installation
|
||||||
|
set "VSPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
|
||||||
|
set "VSVersion=14.10.25017"
|
||||||
|
:: Change to your Windows Kit version & installation
|
||||||
|
set "WinSDKVersion=10.0.15063.0"
|
||||||
|
set "WinSDKPath=C:\Program Files (x86)\Windows Kits\10"
|
||||||
|
:: Change this to your resulting exe
|
||||||
|
set "OUTPUT=test.exe"
|
||||||
|
|
||||||
|
|
||||||
|
:: Setup
|
||||||
|
set "VSBasePath=%VSPath%\VC\Tools\MSVC\%VSVersion%"
|
||||||
|
set "PATH=%PATH%;%LLVMPath%\bin;%VSBasePath%\bin\HostX64\x64"
|
||||||
|
|
||||||
|
:: Compiler Flags
|
||||||
|
set CFLAGS= ^
|
||||||
|
-std=c++14 -Wall -Wextra
|
||||||
|
|
||||||
|
set CPPFLAGS= ^
|
||||||
|
-I "%VSBasePath%\include" ^
|
||||||
|
-I "%WinSDKPath%\Include\%WinSDKVersion%\shared" ^
|
||||||
|
-I "%WinSDKPath%\Include\%WinSDKVersion%\ucrt" ^
|
||||||
|
-I "%WinSDKPath%\Include\%WinSDKVersion%\um"
|
||||||
|
|
||||||
|
|
||||||
|
:: Linker Libs
|
||||||
|
set LDFLAGS= ^
|
||||||
|
-machine:x64 ^
|
||||||
|
-nodefaultlib ^
|
||||||
|
-subsystem:console
|
||||||
|
|
||||||
|
set LDLIBS= ^
|
||||||
|
-libpath:"%VSBasePath%\lib\x64" ^
|
||||||
|
-libpath:"%WinSDKPath%\Lib\%WinSDKVersion%\ucrt\x64" ^
|
||||||
|
-libpath:"%WinSDKPath%\Lib\%WinSDKVersion%\um\x64" ^
|
||||||
|
libucrt.lib libvcruntime.lib libcmt.lib libcpmt.lib ^
|
||||||
|
legacy_stdio_definitions.lib oldnames.lib ^
|
||||||
|
legacy_stdio_wide_specifiers.lib ^
|
||||||
|
kernel32.lib User32.lib
|
||||||
|
|
||||||
|
|
||||||
|
:: Compiling
|
||||||
|
@echo on
|
||||||
|
@for %%f in (*.cc) do (
|
||||||
|
clang++.exe "%%~f" -o "%%~nf.o" -c %CFLAGS%
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Linking
|
||||||
|
@set "LINK_FILES="
|
||||||
|
@for %%f in (*.o) do (
|
||||||
|
@set "LINK_FILES=%LINK_FILES% %%~f"
|
||||||
|
)
|
||||||
|
|
||||||
|
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
|
Loading…
Reference in a new issue