-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e224f26
commit 41bf268
Showing
4 changed files
with
108 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,5 @@ | ||
const std = @import("std"); | ||
const build_options = @import("build_options"); | ||
|
||
test "default" { | ||
const exe_path = build_options.exe_path; | ||
const argv = [_][]const u8{ exe_path, "--time=short" }; | ||
const proc = try std.process.Child.run(.{ | ||
.allocator = std.testing.allocator, | ||
.argv = &argv, | ||
}); | ||
|
||
defer std.testing.allocator.free(proc.stdout); | ||
defer std.testing.allocator.free(proc.stderr); | ||
|
||
const term = proc.term; | ||
|
||
try std.testing.expectEqual(term, std.process.Child.Term{ .Exited = 0 }); | ||
} | ||
|
||
test "columns" { | ||
const exe_path = build_options.exe_path; | ||
const argv = [_][]const u8{ exe_path, "--time=short", "-s=columns" }; | ||
const proc = try std.process.Child.run(.{ | ||
.allocator = std.testing.allocator, | ||
.argv = &argv, | ||
}); | ||
|
||
defer std.testing.allocator.free(proc.stdout); | ||
defer std.testing.allocator.free(proc.stderr); | ||
|
||
const term = proc.term; | ||
|
||
try std.testing.expectEqual(term, std.process.Child.Term{ .Exited = 0 }); | ||
} | ||
|
||
test "crypto" { | ||
const exe_path = build_options.exe_path; | ||
const argv = [_][]const u8{ exe_path, "--time=short", "-s=crypto" }; | ||
const proc = try std.process.Child.run(.{ | ||
.allocator = std.testing.allocator, | ||
.argv = &argv, | ||
}); | ||
|
||
defer std.testing.allocator.free(proc.stdout); | ||
defer std.testing.allocator.free(proc.stderr); | ||
|
||
const term = proc.term; | ||
|
||
try std.testing.expectEqual(term, std.process.Child.Term{ .Exited = 0 }); | ||
comptime { | ||
_ = @import("default.zig"); | ||
_ = @import("columns.zig"); | ||
_ = @import("crypto.zig"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const std = @import("std"); | ||
|
||
const Process = std.process.Child; | ||
const ArrayList = std.ArrayList; | ||
|
||
const build_options = @import("build_options"); | ||
|
||
test "columns" { | ||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | ||
defer arena.deinit(); | ||
const allocator = arena.allocator(); | ||
|
||
const argv = [_][]const u8{ | ||
build_options.exe_path, | ||
"--time=short", | ||
"-s=columns", | ||
}; | ||
|
||
var process = Process.init(&argv, allocator); | ||
process.stdout_behavior = .Pipe; | ||
process.stderr_behavior = .Pipe; | ||
var stdout = ArrayList(u8).init(allocator); | ||
var stderr = ArrayList(u8).init(allocator); | ||
|
||
defer { | ||
stdout.deinit(); | ||
stderr.deinit(); | ||
} | ||
|
||
try process.spawn(); | ||
try process.collectOutput(&stdout, &stderr, 1024); | ||
const term = try process.wait(); | ||
|
||
try std.testing.expectEqual(term.Exited, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const std = @import("std"); | ||
|
||
const Process = std.process.Child; | ||
const ArrayList = std.ArrayList; | ||
|
||
const build_options = @import("build_options"); | ||
|
||
test "crypto" { | ||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | ||
defer arena.deinit(); | ||
const allocator = arena.allocator(); | ||
|
||
const argv = [_][]const u8{ | ||
build_options.exe_path, | ||
"--time=short", | ||
"-s=crypto", | ||
}; | ||
|
||
var process = Process.init(&argv, allocator); | ||
process.stdout_behavior = .Pipe; | ||
process.stderr_behavior = .Pipe; | ||
var stdout = ArrayList(u8).init(allocator); | ||
var stderr = ArrayList(u8).init(allocator); | ||
|
||
defer { | ||
stdout.deinit(); | ||
stderr.deinit(); | ||
} | ||
|
||
try process.spawn(); | ||
try process.collectOutput(&stdout, &stderr, 1024); | ||
const term = try process.wait(); | ||
|
||
try std.testing.expectEqual(term.Exited, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const std = @import("std"); | ||
|
||
const Process = std.process.Child; | ||
const ArrayList = std.ArrayList; | ||
|
||
const build_options = @import("build_options"); | ||
|
||
test "default" { | ||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | ||
defer arena.deinit(); | ||
const allocator = arena.allocator(); | ||
|
||
const argv = [_][]const u8{ | ||
build_options.exe_path, | ||
"--time=short", | ||
}; | ||
|
||
var process = Process.init(&argv, allocator); | ||
process.stdout_behavior = .Pipe; | ||
process.stderr_behavior = .Pipe; | ||
var stdout = ArrayList(u8).init(allocator); | ||
var stderr = ArrayList(u8).init(allocator); | ||
|
||
defer { | ||
stdout.deinit(); | ||
stderr.deinit(); | ||
} | ||
|
||
try process.spawn(); | ||
try process.collectOutput(&stdout, &stderr, 1024); | ||
const term = try process.wait(); | ||
|
||
try std.testing.expectEqual(term.Exited, 0); | ||
} |