mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	Tests: add luacheck for linting tests
Source: https://github.com/mpeterv/luacheck Docs: http://luacheck.readthedocs.org/en/0.12.0/index.html Run via "make testlint".
This commit is contained in:
		| @@ -366,6 +366,8 @@ if(NOT BUSTED_OUTPUT_TYPE) | ||||
|   set(BUSTED_OUTPUT_TYPE "utfTerminal") | ||||
| endif() | ||||
|  | ||||
| find_program(LUACHECK_PRG luacheck) | ||||
|  | ||||
| include(InstallHelpers) | ||||
|  | ||||
| file(GLOB MANPAGES | ||||
| @@ -456,3 +458,11 @@ if(BUSTED_PRG) | ||||
|       -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake | ||||
|     DEPENDS ${BENCHMARK_PREREQS}) | ||||
| endif() | ||||
|  | ||||
| if(LUACHECK_PRG) | ||||
|   add_custom_target(testlint | ||||
|     COMMAND ${CMAKE_COMMAND} | ||||
|       -DLUACHECK_PRG=${LUACHECK_PRG} | ||||
|       -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test | ||||
|       -P ${PROJECT_SOURCE_DIR}/cmake/RunTestsLint.cmake) | ||||
| endif() | ||||
|   | ||||
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							| @@ -86,6 +86,9 @@ oldtest: | nvim | ||||
| functionaltest: | nvim | ||||
| 	+$(BUILD_CMD) -C build functionaltest | ||||
|  | ||||
| testlint: | nvim | ||||
| 	$(BUILD_CMD) -C build testlint | ||||
|  | ||||
| test: functionaltest | ||||
|  | ||||
| unittest: | nvim | ||||
| @@ -110,4 +113,4 @@ lint: | ||||
| 		-DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \ | ||||
| 		-P cmake/RunLint.cmake | ||||
|  | ||||
| .PHONY: test functionaltest unittest lint clean distclean nvim libnvim cmake deps install | ||||
| .PHONY: test testlint functionaltest unittest lint clean distclean nvim libnvim cmake deps install | ||||
|   | ||||
							
								
								
									
										11
									
								
								cmake/RunTestsLint.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								cmake/RunTestsLint.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| execute_process( | ||||
|   COMMAND ${LUACHECK_PRG} -q ${TEST_DIR} | ||||
|   WORKING_DIRECTORY ${TEST_DIR} | ||||
|   ERROR_VARIABLE err | ||||
|   RESULT_VARIABLE res | ||||
|   ${EXTRA_ARGS}) | ||||
|  | ||||
| if(NOT res EQUAL 0) | ||||
|   message(STATUS "Output to stderr:\n${err}") | ||||
|   message(FATAL_ERROR "Linting tests failed with error: ${res}.") | ||||
| endif() | ||||
							
								
								
									
										4
									
								
								test/.luacheckrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								test/.luacheckrc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| -- vim: ft=lua | ||||
|  | ||||
| std = '+luajit +busted' | ||||
| cache = true | ||||
							
								
								
									
										11
									
								
								third-party/cmake/BuildLuarocks.cmake
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								third-party/cmake/BuildLuarocks.cmake
									
									
									
									
										vendored
									
									
								
							| @@ -121,12 +121,19 @@ if(USE_BUNDLED_BUSTED) | ||||
|   add_custom_target(busted | ||||
|     DEPENDS ${HOSTDEPS_BIN_DIR}/busted) | ||||
|  | ||||
|   add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/luacheck | ||||
|     COMMAND ${LUAROCKS_BINARY} | ||||
|     ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/0.12.0/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS} | ||||
|     DEPENDS busted) | ||||
|   add_custom_target(luacheck | ||||
|     DEPENDS ${HOSTDEPS_BIN_DIR}/luacheck) | ||||
|  | ||||
|   add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client | ||||
|     COMMAND ${LUAROCKS_BINARY} | ||||
|     ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-14/nvim-client-0.0.1-14.rockspec ${LUAROCKS_BUILDARGS} LIBUV_DIR=${HOSTDEPS_INSTALL_DIR} | ||||
|     DEPENDS busted libuv) | ||||
|     DEPENDS luacheck libuv) | ||||
|   add_custom_target(nvim-client | ||||
|     DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client) | ||||
|  | ||||
|   list(APPEND THIRD_PARTY_DEPS busted nvim-client) | ||||
|   list(APPEND THIRD_PARTY_DEPS busted luacheck nvim-client) | ||||
| endif() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Marco Hinz
					Marco Hinz