mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-05-04 06:19:14 -05:00
Add first class support for golang hooks
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit.languages.golang import guess_go_dir
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('url', 'expected'),
|
||||
(
|
||||
('/im/a/path/on/disk', 'unknown_src_dir'),
|
||||
('git@github.com:golang/lint', 'github.com/golang/lint'),
|
||||
('git://github.com/golang/lint', 'github.com/golang/lint'),
|
||||
('http://github.com/golang/lint', 'github.com/golang/lint'),
|
||||
('https://github.com/golang/lint', 'github.com/golang/lint'),
|
||||
('ssh://git@github.com/golang/lint', 'github.com/golang/lint'),
|
||||
('git@github.com:golang/lint.git', 'github.com/golang/lint'),
|
||||
),
|
||||
)
|
||||
def test_guess_go_dir(url, expected):
|
||||
assert guess_go_dir(url) == expected
|
||||
@@ -257,6 +257,14 @@ def test_swift_hook(tempdir_factory, store):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_golang_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'golang_hooks_repo',
|
||||
'golang-hook', [], b'hello world\n',
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_missing_executable(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
|
||||
Reference in New Issue
Block a user