mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 10:01:46 +04:00
add test for julia version support
This commit is contained in:
parent
5501721fa9
commit
ae6f19d870
3 changed files with 24 additions and 2 deletions
5
.github/workflows/languages.yaml
vendored
5
.github/workflows/languages.yaml
vendored
|
|
@ -67,7 +67,10 @@ jobs:
|
||||||
if: matrix.language == 'haskell'
|
if: matrix.language == 'haskell'
|
||||||
- uses: r-lib/actions/setup-r@v2
|
- uses: r-lib/actions/setup-r@v2
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.language == 'r'
|
if: matrix.os == 'ubuntu-latest' && matrix.language == 'r'
|
||||||
|
- uses: julia-actions/install-juliaup@v2
|
||||||
|
if: matrix.language == 'julia'
|
||||||
|
- run: juliaup add 1.10.10
|
||||||
|
if: matrix.language == 'julia'
|
||||||
- name: install deps
|
- name: install deps
|
||||||
run: python -mpip install -e . -r requirements-dev.txt
|
run: python -mpip install -e . -r requirements-dev.txt
|
||||||
- name: run tests
|
- name: run tests
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,10 @@ def install_environment(
|
||||||
# copy `src` files if they exist
|
# copy `src` files if they exist
|
||||||
src_dir = prefix.path('src')
|
src_dir = prefix.path('src')
|
||||||
if os.path.isdir(src_dir):
|
if os.path.isdir(src_dir):
|
||||||
shutil.copytree(src_dir, os.path.join(envdir, 'src'))
|
shutil.copytree(
|
||||||
|
src_dir, os.path.join(envdir, 'src'),
|
||||||
|
dirs_exist_ok=True,
|
||||||
|
)
|
||||||
|
|
||||||
# Julia code to instantiate the hook environment
|
# Julia code to instantiate the hook environment
|
||||||
julia_code = """
|
julia_code = """
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,22 @@ def test_julia_hook(tmp_path):
|
||||||
assert run_language(tmp_path, julia, 'src/main.jl') == expected
|
assert run_language(tmp_path, julia, 'src/main.jl') == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_julia_hook_version(tmp_path):
|
||||||
|
code = """
|
||||||
|
using Example
|
||||||
|
function main()
|
||||||
|
println("Hello, Julia $(VERSION)!")
|
||||||
|
end
|
||||||
|
main()
|
||||||
|
"""
|
||||||
|
_make_hook(tmp_path, code)
|
||||||
|
expected = (0, b'Hello, Julia 1.10.10!\n')
|
||||||
|
assert run_language(
|
||||||
|
tmp_path, julia, 'src/main.jl',
|
||||||
|
version='1.10.10',
|
||||||
|
) == expected
|
||||||
|
|
||||||
|
|
||||||
def test_julia_hook_manifest(tmp_path):
|
def test_julia_hook_manifest(tmp_path):
|
||||||
code = """
|
code = """
|
||||||
using Example
|
using Example
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue