update gitattributes and move test data into subdir

This commit is contained in:
Andrew Kelley 2022-12-18 16:28:30 -07:00
parent aca9c74e80
commit e6a4e87f69
10 changed files with 9 additions and 9 deletions

4
.gitattributes vendored
View File

@ -1,9 +1,9 @@
*.zig text eol=lf
*.txt text eol=lf
langref.html.in text eol=lf
deps/SoftFloat-3e/*.txt text eol=crlf
lib/std/compress/testdata/** binary
lib/std/compress/deflate/testdata/** binary
deps/** linguist-vendored
lib/include/** linguist-vendored
lib/libc/** linguist-vendored
lib/libcxx/** linguist-vendored

View File

@ -106,7 +106,7 @@ pub fn build(b: *Builder) !void {
.install_dir = .lib,
.install_subdir = "zig",
.exclude_extensions = &[_][]const u8{
// exclude files from lib/std/compress/
// exclude files from lib/std/compress/testdata
".gz",
".z.0",
".z.9",

View File

@ -172,8 +172,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
test "compressed data" {
try testReader(
@embedFile("rfc1952.txt.gz"),
@embedFile("rfc1952.txt"),
@embedFile("testdata/rfc1952.txt.gz"),
@embedFile("testdata/rfc1952.txt"),
);
}

View File

@ -107,21 +107,21 @@ fn testReader(data: []const u8, expected: []const u8) !void {
// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
test "compressed data" {
const rfc1951_txt = @embedFile("rfc1951.txt");
const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
// Compressed with compression level = 0
try testReader(
@embedFile("rfc1951.txt.z.0"),
@embedFile("testdata/rfc1951.txt.z.0"),
rfc1951_txt,
);
// Compressed with compression level = 9
try testReader(
@embedFile("rfc1951.txt.z.9"),
@embedFile("testdata/rfc1951.txt.z.9"),
rfc1951_txt,
);
// Compressed with compression level = 9 and fixed Huffman codes
try testReader(
@embedFile("rfc1951.txt.fixed.z.9"),
@embedFile("testdata/rfc1951.txt.fixed.z.9"),
rfc1951_txt,
);
}