add runner test + 'zig build test' subcommand

This commit is contained in:
Luna 2019-08-08 16:48:31 -03:00
parent 704eaac081
commit 9fd41a61bf
4 changed files with 38 additions and 9 deletions

View file

@ -127,7 +127,6 @@ pub const Command = struct {
pub const CommandList = std.ArrayList(*Command);
pub const ArgList = std.ArrayList([]const u8);
pub const PluginKeywords = [_]CommandType{ .Amp, .RFlanger };
pub const KeywordMap = std.AutoHashMap([]const u8, CommandType);
pub const Lang = struct {

View file

@ -4,6 +4,7 @@ const runners = @import("runner.zig");
test "scritcher" {
_ = @import("lang.zig");
_ = @import("runner.zig");
}
pub fn main() !void {

View file

@ -469,3 +469,21 @@ pub const Runner = struct {
}
}
};
test "running noop" {
const allocator = std.heap.direct_allocator;
var cmds = lang.CommandList.init(allocator);
defer cmds.deinit();
var cmd_ptr = try allocator.create(lang.Command);
cmd_ptr.* = lang.Command{
.command = .Noop,
.args = lang.ArgList.init(allocator),
};
try cmds.append(cmd_ptr);
var runner = Runner.init(allocator);
defer runner.deinit();
try runner.runCommands(cmds, false);
}