lockdiff/
rust.rs

1#[cfg(test)]
2mod tests {
3    use crate::{parse_toml_lock, Package};
4
5    #[test]
6    fn test_parse_cargo_lock() {
7        let contents = r#"
8# This file is automatically @generated by Cargo.
9version = 3
10
11[[package]]
12name = "anyhow"
13version = "1.0.58"
14source = "registry+https://github.com/rust-lang/crates.io-index"
15
16[[package]]
17name = "lockdiff"
18version = "1.0.0"
19dependencies = [
20 "anyhow",
21]"#;
22        let packages = parse_toml_lock(contents).unwrap();
23        assert_eq!(
24            &packages,
25            &[
26                Package::new("anyhow", "1.0.58"),
27                Package::new("lockdiff", "1.0.0")
28            ]
29        );
30    }
31}