unittest scaffolding

This commit is contained in:
sjorsdonkers
2025-04-09 11:20:33 +02:00
parent 2f47e04de7
commit 3a7da6665f

View File

@@ -60,6 +60,8 @@ const Browser = struct {
self.session.?.* = .{ self.session.?.* = .{
.page = null, .page = null,
.arena = arena, .arena = arena,
.env = Env{},
.inspector = Inspector{},
}; };
return self.session.?; return self.session.?;
} }
@@ -75,6 +77,8 @@ const Browser = struct {
const Session = struct { const Session = struct {
page: ?Page = null, page: ?Page = null,
arena: Allocator, arena: Allocator,
env: Env,
inspector: Inspector,
pub fn currentPage(self: *Session) ?*Page { pub fn currentPage(self: *Session) ?*Page {
return &(self.page orelse return null); return &(self.page orelse return null);
@@ -102,6 +106,54 @@ const Session = struct {
} }
}; };
const Env = struct {
pub fn findOrAddValue(self: *Env, value: anytype) !@TypeOf(value) { // ?
_ = self;
return value;
}
};
const Inspector = struct {
pub fn getRemoteObject(self: Inspector, env: *Env, jsValue: anytype, groupName: []const u8) !RemoteObject {
_ = self;
_ = env;
_ = jsValue;
_ = groupName;
return RemoteObject{};
}
};
const RemoteObject = struct {
pub fn deinit(self: RemoteObject) void {
_ = self;
}
pub fn getType(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
_ = self;
_ = alloc;
return "TheType";
}
pub fn getSubtype(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
_ = self;
_ = alloc;
return "TheSubtype";
}
pub fn getClassName(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
_ = self;
_ = alloc;
return "TheClassName";
}
pub fn getDescription(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
_ = self;
_ = alloc;
return "TheDescription";
}
pub fn getObjectId(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
_ = self;
_ = alloc;
return "TheObjectId";
}
};
const Page = struct { const Page = struct {
session: *Session, session: *Session,
rawuri: []const u8, rawuri: []const u8,