| author | |
| committer | |
| log | d6a5e284b88afa52b2995ea790e3a5b8243e0217 |
| tree | eef39830cef6694339997e4a4c1bcf2dcb3bae7c |
| parent | a6de80638189430453b81b579a0b14e811f8d3aa |
6 files changed, 42 insertions(+), 5 deletions(-)
.gitignore created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | .zig-cache | |
| 2 | zig-out | |
| 3 | .zigmod | |
| 4 | deps.zig | |
| 5 | files.zig | |
| 6 | zigmod.lock |
build.zig created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | const std = @import("std"); | |
| 2 | const deps = @import("./deps.zig"); | |
| 3 | ||
| 4 | pub fn build(b: *std.Build) void { | |
| 5 | const target = b.standardTargetOptions(.{}); | |
| 6 | const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; | |
| 7 | ||
| 8 | const tests = b.addTest(.{ | |
| 9 | .root_source_file = b.path("test.zig"), | |
| 10 | .target = target, | |
| 11 | .optimize = mode, | |
| 12 | }); | |
| 13 | deps.addAllTo(tests); | |
| 14 | ||
| 15 | const test_step = b.step("test", "Run all library tests"); | |
| 16 | const tests_run = b.addRunArtifact(tests); | |
| 17 | tests_run.has_side_effects = true; | |
| 18 | test_step.dependOn(&tests_run.step); | |
| 19 | } |
licenses.txt created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | MIT: | |
| 2 | = https://spdx.org/licenses/MIT | |
| 3 | - This | |
| 4 | - git https://github.com/nektro/zig-expect |
mime.zig+1-5| ... | ... | @@ -4,7 +4,7 @@ const string = []const u8; |
| 4 | 4 | // Many entries added from https://pagure.io/mailcap/blob/master/f/mime.types |
| 5 | 5 | // Last updated as of 9699055a1b4dfb90f7594ee2e8dda705fa56d3b8 |
| 6 | 6 | |
| 7 | const types = std.ComptimeStringMap(string, .{ | |
| 7 | pub const map = std.StaticStringMap(string).initComptime(.{ | |
| 8 | 8 | .{ ".1", "application/x-troff-man" }, |
| 9 | 9 | .{ ".123", "application/vnd.lotus-1-2-3" }, |
| 10 | 10 | .{ ".1clr", "application/clr" }, |
| ... | ... | @@ -1408,7 +1408,3 @@ const types = std.ComptimeStringMap(string, .{ |
| 1408 | 1408 | .{ ".zone", "text/dns" }, |
| 1409 | 1409 | .{ ".zst", "application/zstd" }, |
| 1410 | 1410 | }); |
| 1411 | ||
| 1412 | pub fn typeByExtension(comptime ext: string) ?string { | |
| 1413 | return types.get(ext); | |
| 1414 | } |
test.zig created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mime = @import("mime"); | |
| 3 | const expect = @import("expect").expect; | |
| 4 | ||
| 5 | test { | |
| 6 | try expect(mime.map.get(".html")).toEqualString("text/html"); | |
| 7 | } | |
| 8 | test { | |
| 9 | try expect(mime.map.get(".sillybogo")).toBeNull(); | |
| 10 | } |
zigmod.yml+2| ... | ... | @@ -2,3 +2,5 @@ id: f3k4y5cdrgemtq38ztm7kqjnr3tq9az396e8vu2a |
| 2 | 2 | name: mime |
| 3 | 3 | main: mime.zig |
| 4 | 4 | license: MIT |
| 5 | root_dependencies: | |
| 6 | - src: git https://github.com/nektro/zig-expect |