mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Add naive and untested version of Lua language support.
This commit is contained in:
parent
7a305e5d9a
commit
3f8be7400d
13 changed files with 286 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ from pre_commit.envcontext import envcontext
|
|||
from pre_commit.hook import Hook
|
||||
from pre_commit.languages import golang
|
||||
from pre_commit.languages import helpers
|
||||
from pre_commit.languages import lua
|
||||
from pre_commit.languages import node
|
||||
from pre_commit.languages import python
|
||||
from pre_commit.languages import ruby
|
||||
|
|
@ -34,6 +35,7 @@ from testing.util import cwd
|
|||
from testing.util import get_resource_path
|
||||
from testing.util import skipif_cant_run_coursier
|
||||
from testing.util import skipif_cant_run_docker
|
||||
from testing.util import skipif_cant_run_lua
|
||||
from testing.util import skipif_cant_run_swift
|
||||
from testing.util import xfailif_windows
|
||||
|
||||
|
|
@ -1128,3 +1130,30 @@ def test_non_installable_hook_error_for_additional_dependencies(store, caplog):
|
|||
'using language `system` which does not install an environment. '
|
||||
'Perhaps you meant to use a specific language?'
|
||||
)
|
||||
|
||||
|
||||
@skipif_cant_run_lua # pragma: win32 no cover
|
||||
def test_lua_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'lua_repo',
|
||||
'hello-world-lua', [], b'hello world\n',
|
||||
)
|
||||
|
||||
|
||||
@skipif_cant_run_lua # pragma: win32 no cover
|
||||
def test_local_lua_additional_dependencies(store):
|
||||
lua_entry = lua._find_lua(C.DEFAULT)
|
||||
config = {
|
||||
'repo': 'local',
|
||||
'hooks': [{
|
||||
'id': 'local-lua',
|
||||
'name': 'local-lua',
|
||||
'entry': lua_entry,
|
||||
'language': 'lua',
|
||||
'args': ['-e', 'require "inspect"; print("hello world")'],
|
||||
'additional_dependencies': ['inspect'],
|
||||
}],
|
||||
}
|
||||
hook = _get_hook(config, store, 'local-lua')
|
||||
ret, out = _hook_run(hook, (), color=False)
|
||||
assert (ret, _norm_out(out)) == (0, b'hello world\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue