diff options
author | Ryan Lahfa <tvl@lahfa.xyz> | 2024-08-12T16·15+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-08-19T19·18+0000 |
commit | 7612cb4c31fadd7ccaa7672cf551b9d21d7884b4 (patch) | |
tree | ba4525f40ddc395287700ae9f9612f9874982fe8 /tvix/nix-compat/src/nar/listing/test.rs | |
parent | 73e16c18552d0bd6866fad7e8f87fb74faeca1e4 (diff) |
feat(tvix/nix-compat): add a basic listing deserializer r/8539
.ls files are useful to seek in a NAR without parsing it entirely. The responsibility of validating the files is on the caller. Change-Id: I5d1da28b5479c38f20ca5babe60e362a2217c9ea Signed-off-by: Ryan Lahfa <tvl@lahfa.xyz> Reviewed-on: https://cl.tvl.fyi/c/depot/+/12196 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/nar/listing/test.rs')
-rw-r--r-- | tvix/nix-compat/src/nar/listing/test.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/nix-compat/src/nar/listing/test.rs b/tvix/nix-compat/src/nar/listing/test.rs new file mode 100644 index 000000000000..088a6133f531 --- /dev/null +++ b/tvix/nix-compat/src/nar/listing/test.rs @@ -0,0 +1,10 @@ +use crate::nar; + +#[test] +fn nixos_release() { + let listing_bytes = include_bytes!("../tests/nixos-release.ls"); + let listing: nar::listing::Listing = serde_json::from_slice(listing_bytes).unwrap(); + + let nar::listing::Listing::V1 { root, .. } = listing; + assert!(matches!(root, nar::listing::ListingEntry::Directory { .. })); +} |