diff --git a/testing/resources/swift_hooks_repo/.gitignore b/testing/resources/swift_hooks_repo/.gitignore new file mode 100644 index 00000000..02c08753 --- /dev/null +++ b/testing/resources/swift_hooks_repo/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj diff --git a/testing/resources/swift_hooks_repo/Package.swift b/testing/resources/swift_hooks_repo/Package.swift new file mode 100644 index 00000000..6e02c188 --- /dev/null +++ b/testing/resources/swift_hooks_repo/Package.swift @@ -0,0 +1,5 @@ +import PackageDescription + +let package = Package( + name: "swift_hooks_repo" +) diff --git a/testing/resources/swift_hooks_repo/Sources/main.swift b/testing/resources/swift_hooks_repo/Sources/main.swift new file mode 100644 index 00000000..f7cf60e1 --- /dev/null +++ b/testing/resources/swift_hooks_repo/Sources/main.swift @@ -0,0 +1 @@ +print("Hello, world!") diff --git a/testing/resources/swift_hooks_repo/hooks.yaml b/testing/resources/swift_hooks_repo/hooks.yaml new file mode 100644 index 00000000..c08df87d --- /dev/null +++ b/testing/resources/swift_hooks_repo/hooks.yaml @@ -0,0 +1,6 @@ +- id: swift-hooks-repo + name: Swift hooks repo example + description: Runs the hello world app generated by swift package init --type executable (binary called swift_hooks_repo here) + entry: swift_hooks_repo + language: swift + files: \.(swift)$ diff --git a/tests/repository_test.py b/tests/repository_test.py index ad3c8234..1bf5a94d 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -214,6 +214,14 @@ def test_system_hook_with_spaces(tempdir_factory, store): ) +@pytest.mark.integration +def test_swift_hook(tempdir_factory, store): + _test_hook_repo( + tempdir_factory, store, 'swift_hooks_repo', + 'swift-hooks-repo', [], b'Hello, world!\n', + ) + + @pytest.mark.integration def test_missing_executable(tempdir_factory, store): _test_hook_repo(