Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove raw string hashes for readability #732

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions tests/bans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ fn allow_path_wildcards_public_package() {
let diags = gather_bans(
func_name!(),
KrateGather::new("wildcards/allow-paths-public"),
r#"
r"
multiple-versions = 'allow'
wildcards = 'deny'
allow-wildcard-paths = true
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -108,11 +108,11 @@ fn allow_path_wildcards_private_package() {
let diags = gather_bans(
func_name!(),
KrateGather::new("wildcards/allow-paths-private"),
r#"
r"
multiple-versions = 'allow'
wildcards = 'deny'
allow-wildcard-paths = true
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -138,11 +138,11 @@ fn ignores_unpublished_crates() {
func_name!(),
// If either the workspace `root` or `member-one` crates are pulled in,
// they will emit diagnostics that won't be emitted by just including member-two
r#"
r"
multiple-versions = 'allow'
wildcards = 'deny'
allow-wildcard-paths = true
"#
"
.into(),
|ctx, tx| {
cargo_deny::bans::check(ctx, None, tx);
Expand All @@ -158,11 +158,11 @@ fn allow_git_wildcards_private_package() {
let diags = gather_bans(
func_name!(),
KrateGather::new("wildcards/allow-git"),
r#"
r"
multiple-versions = 'allow'
wildcards = 'deny'
allow-wildcard-paths = true
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -176,10 +176,10 @@ fn deterministic_duplicate_ordering() {
let diags = gather_bans(
func_name!(),
KrateGather::new("duplicates"),
r#"
r"
multiple-versions = 'deny'
multiple-versions-include-dev = true
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand Down Expand Up @@ -208,10 +208,10 @@ fn duplicate_graphs() {
use cargo_deny::bans;

let krates = KrateGather::new("duplicates").gather();
let cfg = r#"
let cfg = r"
multiple-versions = 'deny'
multiple-versions-include-dev = true
"#
"
.into();

let dup_graphs = std::sync::Arc::new(parking_lot::Mutex::new(Vec::new()));
Expand All @@ -238,14 +238,14 @@ fn deny_multiple_versions_for_specific_krates() {
let diags = gather_bans(
func_name!(),
KrateGather::new("duplicates"),
r#"
r"
multiple-versions = 'allow'
multiple-versions-include-dev = true
deny = [
{ name = 'block-buffer', deny-multiple-versions = true },
{ name = 'generic-array', deny-multiple-versions = true },
]
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -261,11 +261,11 @@ fn deny_target_specific_dependencies() {
no_default_features: true,
..Default::default()
},
r#"
r"
deny = [
'serde'
]
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -278,11 +278,11 @@ deny = [
targets: &["x86_64-windows-pc-msvc"],
..Default::default()
},
r#"
r"
deny = [
'serde'
]
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -295,11 +295,11 @@ deny = [
targets: &["x86_64-windows-pc-msvc", "aarch64-linux-android"],
..Default::default()
},
r#"
r"
deny = [
'serde'
]
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -316,13 +316,13 @@ fn deny_duplicate_workspace_items() {
targets: &["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"],
..Default::default()
},
r#"
r"
multiple-versions = 'allow'

[workspace-dependencies]
include-path-dependencies = true
unused = 'warn'
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand All @@ -339,7 +339,7 @@ fn unused_skips_generate_warnings() {
targets: &["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"],
..Default::default()
},
r#"
r"
multiple-versions = 'deny'
skip = [
# This actually has 3 versions, skip the two lower ones
Expand All @@ -349,7 +349,7 @@ skip = [
# This crate is in the graph, but there is only one version
'serde_json',
]
"#,
",
);

insta::assert_json_snapshot!(diags);
Expand Down
8 changes: 4 additions & 4 deletions tests/bans_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ fn detects_scripts_by_builtin_glob() {
..Default::default()
},
Config::new(
r#"
r"
[build]
enable-builtin-globs = true
include-dependencies = true
"#,
",
),
);

Expand Down Expand Up @@ -103,11 +103,11 @@ fn detects_native_executables() {
..Default::default()
},
Config::new(
r#"
r"
[build]
enable-builtin-globs = true
include-dependencies = true
"#,
",
),
);

Expand Down
8 changes: 4 additions & 4 deletions tests/licenses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ license-files = [
#[test]
fn handles_dev_dependencies() {
let cfg = tu::Config::new(
r#"
r"
allow = ['Apache-2.0']
include-dev = true
"#,
",
);

let mut diags = gather_licenses_with_overrides(func_name!(), cfg, None);
Expand All @@ -267,9 +267,9 @@ fn forces_apache_over_pixar() {
.unwrap();

let cfg = tu::Config::new(
r#"
r"
allow = ['Apache-2.0']
"#,
",
);

let (ctx, summary) = setup(&krates, func_name!(), cfg);
Expand Down
Loading