(tmp_path)
| 7 | |
| 8 | |
| 9 | def test_perl_install(tmp_path): |
| 10 | makefile_pl = '''\ |
| 11 | use strict; |
| 12 | use warnings; |
| 13 | |
| 14 | use ExtUtils::MakeMaker; |
| 15 | |
| 16 | WriteMakefile( |
| 17 | NAME => "PreCommitHello", |
| 18 | VERSION_FROM => "lib/PreCommitHello.pm", |
| 19 | EXE_FILES => [qw(bin/pre-commit-perl-hello)], |
| 20 | ); |
| 21 | ''' |
| 22 | bin_perl_hello = '''\ |
| 23 | #!/usr/bin/env perl |
| 24 | |
| 25 | use strict; |
| 26 | use warnings; |
| 27 | use PreCommitHello; |
| 28 | |
| 29 | PreCommitHello::hello(); |
| 30 | ''' |
| 31 | lib_hello_pm = '''\ |
| 32 | package PreCommitHello; |
| 33 | |
| 34 | use strict; |
| 35 | use warnings; |
| 36 | |
| 37 | our $VERSION = "0.1.0"; |
| 38 | |
| 39 | sub hello { |
| 40 | print "Hello from perl-commit Perl!\n"; |
| 41 | } |
| 42 | |
| 43 | 1; |
| 44 | ''' |
| 45 | tmp_path.joinpath('Makefile.PL').write_text(makefile_pl) |
| 46 | bin_dir = tmp_path.joinpath('bin') |
| 47 | bin_dir.mkdir() |
| 48 | exe = bin_dir.joinpath('pre-commit-perl-hello') |
| 49 | exe.write_text(bin_perl_hello) |
| 50 | make_executable(exe) |
| 51 | lib_dir = tmp_path.joinpath('lib') |
| 52 | lib_dir.mkdir() |
| 53 | lib_dir.joinpath('PreCommitHello.pm').write_text(lib_hello_pm) |
| 54 | |
| 55 | ret = run_language(tmp_path, perl, 'pre-commit-perl-hello') |
| 56 | assert ret == (0, b'Hello from perl-commit Perl!\n') |
| 57 | |
| 58 | |
| 59 | def test_perl_additional_dependencies(tmp_path): |
nothing calls this directly
no test coverage detected