Skip to content

Commit 3a7da66

Browse files
committed
unittest scaffolding
1 parent 2f47e04 commit 3a7da66

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/cdp/testing.zig

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const Browser = struct {
6060
self.session.?.* = .{
6161
.page = null,
6262
.arena = arena,
63+
.env = Env{},
64+
.inspector = Inspector{},
6365
};
6466
return self.session.?;
6567
}
@@ -75,6 +77,8 @@ const Browser = struct {
7577
const Session = struct {
7678
page: ?Page = null,
7779
arena: Allocator,
80+
env: Env,
81+
inspector: Inspector,
7882

7983
pub fn currentPage(self: *Session) ?*Page {
8084
return &(self.page orelse return null);
@@ -102,6 +106,54 @@ const Session = struct {
102106
}
103107
};
104108

109+
const Env = struct {
110+
pub fn findOrAddValue(self: *Env, value: anytype) !@TypeOf(value) { // ?
111+
_ = self;
112+
return value;
113+
}
114+
};
115+
116+
const Inspector = struct {
117+
pub fn getRemoteObject(self: Inspector, env: *Env, jsValue: anytype, groupName: []const u8) !RemoteObject {
118+
_ = self;
119+
_ = env;
120+
_ = jsValue;
121+
_ = groupName;
122+
return RemoteObject{};
123+
}
124+
};
125+
126+
const RemoteObject = struct {
127+
pub fn deinit(self: RemoteObject) void {
128+
_ = self;
129+
}
130+
pub fn getType(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
131+
_ = self;
132+
_ = alloc;
133+
return "TheType";
134+
}
135+
pub fn getSubtype(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
136+
_ = self;
137+
_ = alloc;
138+
return "TheSubtype";
139+
}
140+
pub fn getClassName(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
141+
_ = self;
142+
_ = alloc;
143+
return "TheClassName";
144+
}
145+
pub fn getDescription(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
146+
_ = self;
147+
_ = alloc;
148+
return "TheDescription";
149+
}
150+
pub fn getObjectId(self: RemoteObject, alloc: std.mem.Allocator) ![:0]const u8 {
151+
_ = self;
152+
_ = alloc;
153+
return "TheObjectId";
154+
}
155+
};
156+
105157
const Page = struct {
106158
session: *Session,
107159
rawuri: []const u8,

0 commit comments

Comments
 (0)