Skip to content

Commit 0bd52bf

Browse files
authored
Merge pull request #10 from dpaoliello/basictests
Add tests: round-trip with object, and compare to llvm-ar
2 parents 911f19f + 7876aaf commit 0bd52bf

File tree

5 files changed

+483
-5
lines changed

5 files changed

+483
-5
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
target
2-
Cargo.lock
1+
/target
2+
/Cargo.lock
3+
/.vscode

Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ repository = "https://github.com/rust-lang/ar_archive_writer"
1212

1313
[dependencies]
1414
object = { version = "0.32.0", default-features = false, features = ["std", "read"] }
15+
16+
[dev-dependencies]
17+
cargo-binutils = "0.3.6"
18+
object = { version = "0.32.0", default-features = false, features = ["write", "xcoff"] }
19+
pretty_assertions = "1.4.0"

rust-toolchain.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "stable"
3+
components = ["llvm-tools"]

src/archive_writer.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,7 @@ fn compute_member_data<'a, S: Write + Seek>(
497497
*filename_count.entry(&*m.member_name).or_insert(0) += 1;
498498
}
499499
for (_name, count) in filename_count.iter_mut() {
500-
if *count > 1 {
501-
*count = 1;
502-
}
500+
*count = if *count > 1 { 1 } else { 0 };
503501
}
504502
}
505503

0 commit comments

Comments
 (0)