mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 00:24:47 +04:00
Merge 558793bbc2 into 8416413a0e
This commit is contained in:
commit
b534cafc2d
2 changed files with 36 additions and 8 deletions
|
|
@ -44,13 +44,19 @@ def _make_hello_world(tmp_path):
|
|||
src_dir.joinpath('main.rs').write_text(
|
||||
'fn main() {\n'
|
||||
' println!("Hello, world!");\n'
|
||||
' if cfg!(feature = "foo") {\n'
|
||||
' println!("With feature foo");\n'
|
||||
' }\n'
|
||||
'}\n',
|
||||
)
|
||||
tmp_path.joinpath('Cargo.toml').write_text(
|
||||
'[package]\n'
|
||||
'name = "hello_world"\n'
|
||||
'version = "0.1.0"\n'
|
||||
'edition = "2021"\n',
|
||||
'edition = "2021"\n'
|
||||
'\n'
|
||||
'[features]\n'
|
||||
'foo = []\n',
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -113,3 +119,12 @@ def test_run_lib_additional_dependencies(tmp_path):
|
|||
assert bin_dir.is_dir()
|
||||
assert not bin_dir.joinpath('shellharden').exists()
|
||||
assert not bin_dir.joinpath('shellharden.exe').exists()
|
||||
|
||||
|
||||
def test_run_features_additional_dependencies(tmp_path):
|
||||
_make_hello_world(tmp_path)
|
||||
|
||||
deps = ('shellharden:4.2.0', 'git-version')
|
||||
cargo_params = ('--', '--features', 'foo')
|
||||
ret = run_language(tmp_path, rust, 'hello_world', deps=deps + cargo_params)
|
||||
assert ret == (0, b'Hello, world!\nWith feature foo\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue