Merging upstream version 3.0.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
962b6a60c2
commit
3904671ae3
107 changed files with 1775 additions and 2323 deletions
31
tests/languages/swift_test.py
Normal file
31
tests/languages/swift_test.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit.languages import swift
|
||||
from testing.language_helpers import run_language
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
sys.platform == 'win32',
|
||||
reason='swift is not supported on windows',
|
||||
)
|
||||
def test_swift_language(tmp_path): # pragma: win32 no cover
|
||||
package_swift = '''\
|
||||
// swift-tools-version:5.0
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "swift_hooks_repo",
|
||||
targets: [.target(name: "swift_hooks_repo")]
|
||||
)
|
||||
'''
|
||||
tmp_path.joinpath('Package.swift').write_text(package_swift)
|
||||
src_dir = tmp_path.joinpath('Sources/swift_hooks_repo')
|
||||
src_dir.mkdir(parents=True)
|
||||
src_dir.joinpath('main.swift').write_text('print("Hello, world!")\n')
|
||||
|
||||
expected = (0, b'Hello, world!\n')
|
||||
assert run_language(tmp_path, swift, 'swift_hooks_repo') == expected
|
Loading…
Add table
Add a link
Reference in a new issue