mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 04:30:59 +01:00
tests: Move invalid nar tests from tests/functional to libutil-tests
Since 242f362567 we have better infrastructure
for this kind of tests.
This commit is contained in:
parent
fb117e0cac
commit
0619351326
9 changed files with 15 additions and 29 deletions
|
|
@ -42,6 +42,20 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
NarTest,
|
||||
InvalidNarTest,
|
||||
::testing::Values(
|
||||
std::pair{"invalid-tag-instead-of-contents", "bad archive: expected tag 'contents', got 'AAAAAAAA'"}));
|
||||
std::pair{"invalid-tag-instead-of-contents", "bad archive: expected tag 'contents', got 'AAAAAAAA'"},
|
||||
// Unpacking a NAR with a NUL character in a file name should fail.
|
||||
std::pair{"nul-character", "bad archive: NAR contains invalid file name 'f"},
|
||||
// Likewise for a '.' filename.
|
||||
std::pair{"dot", "bad archive: NAR contains invalid file name '.'"},
|
||||
// Likewise for a '..' filename.
|
||||
std::pair{"dotdot", "bad archive: NAR contains invalid file name '..'"},
|
||||
// Likewise for a filename containing a slash.
|
||||
std::pair{"slash", "bad archive: NAR contains invalid file name 'x/y'"},
|
||||
// Likewise for an empty filename.
|
||||
std::pair{"empty", "bad archive: NAR contains invalid file name ''"},
|
||||
// Test that the 'executable' field cannot come before the 'contents' field.
|
||||
std::pair{"executable-after-contents", "bad archive: expected tag ')', got 'executable'"},
|
||||
// Test that the 'name' field cannot come before the 'node' field in a directory entry.
|
||||
std::pair{"name-after-node", "bad archive: expected tag 'name'"}));
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
BIN
src/libutil-tests/data/nars/dot.nar
Normal file
BIN
src/libutil-tests/data/nars/dot.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/dotdot.nar
Normal file
BIN
src/libutil-tests/data/nars/dotdot.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/empty.nar
Normal file
BIN
src/libutil-tests/data/nars/empty.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/executable-after-contents.nar
Normal file
BIN
src/libutil-tests/data/nars/executable-after-contents.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/name-after-node.nar
Normal file
BIN
src/libutil-tests/data/nars/name-after-node.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/nul-character.nar
Normal file
BIN
src/libutil-tests/data/nars/nul-character.nar
Normal file
Binary file not shown.
BIN
src/libutil-tests/data/nars/slash.nar
Normal file
BIN
src/libutil-tests/data/nars/slash.nar
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue